[Openmcl-devel] Poll: what do you think of binding-block?

Lennart Staflin lstaflin at gmail.com
Sun Feb 10 01:25:33 PST 2008


On Feb 10, 2008 2:34 AM, Ron Garret <ron at awun.net> wrote:
> In the context of a debate over Paul Graham's new Arc language I wrote
> a macro called binding-block or BB for short.  The intent of the macro
> was to illustrate how the relentless pursuit of brevity would lead to
> some really perverse looking code.  But now, ironically, I've actually
> found binding-block kind of growing on me.  It's basically a keyword-
> based replacement for a bunch of binding constructs (LET, MULTIPLE-
> VALUE-BIND, DESTRUCTURING-BIND, and most WITH-XXX forms) kinda-sorta
> like LOOP is a keyword-based replacement for DO, DOTIMES, MAP, etc.
> The syntax is:
>
> (bb
>   [var form |
>    :mv (var1 var2 ...) form |
>    :db pattern form |
>    :with spec |
>    form]*
>    [result]
> )
>

I've experimented with something similar (but with more parentheses):

(nest
  (:var x 12)
  (:fn foo (n) (+ n 12))
  (:alias y (1+ x))
  (list x (foo x) y))

becomes

(LET ((X 12))
  (FLET ((FOO (N) (+ N 12)))
    (SYMBOL-MACROLET ((Y (1+ X)))
      (LIST X (FOO X) Y))))

I have a project where I use this and several other macros
extensively. If I ever am going to publish that project, I will do a
review of the macros I use to see if they really make the code better.
I think you have to use is for a while to give it a fair try.

-- 
//Lennart Staflin



More information about the Openmcl-devel mailing list