[racket] Onlisp's condlet macro in Racket

From: Sean Kanaley (skanaley at gmail.com)
Date: Wed Jan 2 17:46:55 EST 2013

Thanks all for the help.

Stephan:  Good point about let*--I should've thought of it.  Depending on
how sufficiently-smart (tm) Racket is, is it not very slightly slower to
create more bindings at run time (I suppose it could analyze bindings not
used or immediately shadowed and drop them)?  I'm not arguing *against* the
let* solution, merely curious--I'll take 0.0001% slower for half the code.

Matthias:  Thanks for the example of Stephan's solution...it's roughly 10x
better than my posted version (which was based on a 10x even worse version
before I understood the pattern matching better, which was roughly
comparable to the defmacro version ;))

What makes you say condlet is questionable?  Are there built in racket
primitives or library extensions that achieve similar goals?  It is just a
bad way to program, perhaps because of "randomly" bound nulls?

Vincent:  thanks for the info about define-for-syntax et al.  It'd be
awesome if there was a Seasoned Racketeer or On Racket or Real World Racket
or Racket: App. and Interp. that took full advantage of Racket's unique
advantages to showcase its power.  I'm stuck reading the docs a little bit
at a time...

My understanding from the linked blog is Racket uses phases so e.g.
changing functions at REPL like (set! remove-duplicates-by 3) that might be
used in macros called after this don't use the new binding.  But if I
define a global run-time function, can't it be renamed in the macro phase
as <function_name>_1, in the same way macros perform renaming as shown in
the swap! example from the official docs?  Now when I run-time set
<function_name> to 5, it's still using <function_name>_1 and so does not
affect macro expansion.  If explaining it is too tedious or too above my
current understanding feel free to say as much.

Robby:  I changed it to syntax-rules and you appear to be correct (still
works).  Error checking be damned...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130102/87a44c8c/attachment.html>

Posted on the users mailing list.