[plt-scheme] literal objects in code?

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Sep 9 21:37:21 EDT 2006

On Sep 10, Paul Graham wrote:
> Is it possible to insert literal objects like hash-tables into
> macroexpansions in mzscheme?  I know this is generally forbidden
> in Scheme, but I wonder if you guys have defined some switch
> that allows it.  There are lots of things you can do if you can
> do this, e.g. define a constant time case expression on integers
> by inserting an array built at macroexpansion-time into the 
> code.  --pg

It is possible, and you can protect things further by putting the
object inside a quote or a #%datum -- but the resulting code will not
be compilable.  If the values that you want to use are things like
arrays and hash tables, then you can use `begin-lifted' to achieve the
same effect and still have compilable code.

          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!

Posted on the users mailing list.