[racket] Bouncing default value

From: Laurent (laurent.orseau at gmail.com)
Date: Tue Feb 14 11:57:41 EST 2012

>
> > (define default (gensym))
> > (define (default? x) (equal? x default))
>
> (Using `eq?' here is a common idiom.)
>

ah, of course, thanks for the reminder.


>
> In any case, the real point here is not the macro -- it's the
> existence of a special `none' value that marks an unsupplied value.
>

absolutely, it's just a helper.


> It's potentially a convenient thing to have (which I wish for every
> time I do that `gensym' dance), but it gets tricky with the fact that
> you might want to actually use that value -- same as the undefined
> value (which you get from (letrec ([x x]) x)) which could be used for
> the same purpose.
>

you mean because of shadowing? (I'm not sure I understood what you mean)


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

Posted on the users mailing list.