Hi,

On Aug 4, 2:32 am, Yang Dong <ydong.pub...@gmail.com> wrote:

> Thank you! I have just another question not related about this topic:
>
> ;during bootstrap we don't have destructuring let, loop or fn, will
> redefine later
> (def
>   ^{:macro true
>     :added "1.0"}
>   let (fn* let [&form &env & decl] (cons 'let* decl)))
>
> In Clojure 1.2.0, the preceding definition of let taks the strange
> argument of `&form' and `&env'. What are they?

user=> (defmacro foo [x y] (prn &form) (prn &env) `(+ ~x ~y))
#'user/foo
user=> (let [x 5] (foo x 6))
(foo x 6)
{x #<LocalBinding clojure.lang.compiler$localbind...@13f991>}
11

&form contains the form how the macro was called. &env contains local
bindings in the macro environment. (At least this is what my little
test shows...) These magic parameters are given to all parameters, but
usually hidden. It's probably safe to ignore them if you don't know
what they really do.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to