[racket] How to make an identifier that will have a certain binding no matter what phase level it's referenced at?

From: Alexander D. Knauth (alexander at knauth.org)
Date: Thu Jul 24 21:24:20 EDT 2014

How can I make an identifier that will have a certain binding no matter what phase level it's referenced at?

For example if I’m making a reader extension that will produce a lambda expression, how do I make it so that the lambda expression will be able to exist at any phase level?

For example this program using #lang rackjure doesn’t work:
#lang rackjure
(require (for-meta 1 racket/base)
         (for-meta 2 racket/base)
         (for-meta 3 racket/base)
         (for-meta 4 racket/base)
         )
                                                                                             
#λ(* 2 %) ; works, produces approx. (lambda (%) (* 2 %))
(begin-for-syntax
  (begin-for-syntax
    #λ(* 2 %) ; lambda: unbound identifier at phase 2;
    ;         ;   also, no #%app syntax transformer is bound in: lambda
    ))

Is there any way to construct an identifier that would be bound to lambda from racket/base no matter what phase level it’s used in?


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

Posted on the users mailing list.