[racket] .racketrc question

From: Eli Barzilay (eli at barzilay.org)
Date: Sat Apr 23 08:18:25 EDT 2011

Two days ago, Anurag Mendhekar wrote:
> I'm having trouble understanding how .racketrc works. I'm trying to
> define the character λ to be 'lambda' as follows to be globally
> available, through the .racketrc.
> (define-syntax λ
>     (syntax-rules ()
>        ((_ args body ...)
>        (lambda args body ...))))
> This first basic attempt of adding this definition to .racketrc does
> not work. The definition is not available at the prompt, or in other
> modules. I tried a few other things, but nothing seems to have
> worked. What's the best way to put in globally available syntax
> definitions through the .racketrc?  Or, is there another way of
> doing this that is more in line with Racket paradigms?

The .racketrc file is being loaded into Racket when it starts, so
definitions that are made there are not useful inside modules.  In
general, there is no way to do that other than changing the modules or
adding your own.  (And this is very intentional.)  Also, if you're
using DrRacket then it has no effect.

But you might have a different problem, since `λ' is already bound in
a similar way in the racket language.  (It's not bound in languages
like r5rs though.)

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

Posted on the users mailing list.