[Openmcl-devel] Poll: what do you think of binding-block?
mb at bese.it
Sun Feb 10 12:19:29 UTC 2008
"Lennart Staflin" <lstaflin at gmail.com> writes:
> I've experimented with something similar (but with more parentheses):
> (:var x 12)
> (:fn foo (n) (+ n 12))
> (:alias y (1+ x))
> (list x (foo x) y))
> (LET ((X 12))
> (FLET ((FOO (N) (+ N 12)))
> (SYMBOL-MACROLET ((Y (1+ X)))
> (LIST X (FOO X) Y))))
i've also experimented with (but never ended up using) something
(defmacro nesting (&rest clauses)
`(,@(first clauses) (nesting ,@(rest clauses)))
so your example above is just:
(let ((x 12)))
(flet ((foo (n)
(+ n 12))))
(symbol-macrolet ((y (1+ x))))
(list x (foo x) y)))
I tend to prefer this above other, less verbose, macros since it doesn't
require you to learn any new names and adding new kinds of binding
clauses requires you to just write it:
(with-open-file (input "/input" :direction :input))
(with-open-file (output "/output" :direction :output))
Ring the bells that still can ring.
Forget your perfect offering.
There is a crack in everything.
That's how the light gets in.
More information about the Openmcl-devel