[plt-scheme] partial evaluation and mzc [was: The programs that write the programs]

From: Eric Kidd (eric.kidd at gmail.com)
Date: Wed Oct 20 11:49:46 EDT 2004

On Tue, 19 Oct 2004 15:41:26 +0000, Artem Baguinski <artm at v2.nl> wrote:
> On Sun, 17 Oct 2004 13:04:14 +0200, Jens Axel Søgaard wrote:
> >     <http://www.lisp-p.org/htdocs/peval/peval.cgi>
> very nice article indeed.

Agreed.  That's definitely a must-read for anybody who hasn't done
partial evaluation yet (I haven't).

> I'd like to learn/try the partial evaluation approach to generate fast
> matrix / image processing operations.
> But often it is faster to combine several
> pixel / scan line operations in one loop what simple approach does not
> allow (among other things to minimise memory access)

This is a very cool idea, although you should definitely look into
automatically generating code for modern GPUs, which have far more
image processing horsepower than the main CPU.  There's a weird--but
cool--library which uses C++ as macro language and partial evaluator
for various GPU languages; you can find it at SourceForge:


I have friends who write image munging code for a living, and I've
talked these ideas over with them in the past.  In general, generating
image processing code from Scheme seems to be a very good idea.

In answer to your second question, generating ANSI C from Scheme is
not hard at all--you could probably define a prefix-syntax for C, and
use it as a target language for macro expansion and partial

I'm actually quite interested in working on this in my (non-existent) free time.


Posted on the users mailing list.