[racket] Eval on quasiquoted expression

From: Milan Markovic (zivotinja at gmail.com)
Date: Fri Jul 2 07:00:44 EDT 2010

Hello everybody,

This is my first post to Racket mailing list and hopefully not my last one.

I am working on a project at my university that has to do with genetic
programming. I wanted to implement the whole assignment in Racket because of
some of its really cool features that I found useful.

I create a randomly chosen tree of expressions with "bound" symbol, say x.
Something like this:

(define tree '(+ x (* 3 (* x x)))

Now I want to turn into a procedure by calling

(tree->proc tree 'x)

I defined this function like this

(define (tree->proc tree symbol)
  (eval `(lambda (,symbol) tree)))

and it works in the REPL, but when i call tree->proc from inside the
definitions window it produces the error
"compile: unbound identifier (and no #%app syntax transformer is bound) in:

I have tried several other Scheme implementations and they do not complain
about this. From what I've learned from "JRM's Syntax-rules Primer for the
Merely Eccentric" certain environments do not have syntactic mapping for
function calls.

I guess it is something trivial but cannot figure it out from the

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100702/fb00ae73/attachment.html>

Posted on the users mailing list.