On Mar 19, 2009, at 12:28 AM, e wrote:

just started reading it and already have some new perspectives. Like, I didn't really know that "let" variables could depend on each other. I would have expected that to be let*, but I just looked in the API, and I don't see a let*, which seems odd to me. What's that all about?

Binding sequentially in "let" and allowing "redefinition" (really binding of a new local with the same name) later in the vector is Clojure's behavior and I think it's a good one. One way to think of it is that let's first argument is a vector of bindings. A vector is a sequential (as opposed to parallel) collection, so it fits nicely that the bindings are processed sequentially.

Because parallel bindings are also useful, I think it's an interesting idea to extend let to allow it to take parallel bindings in a map instead of a vector. These would act like Common Lisp's "let":

        (def a 4)
        (let {a 1 b a c 3}
          (prn a b c))

        1 4 3

(I recall reading about this somewhere, possibly as something Rich considered and rejected, so it's not an original idea. It's just something I think about from time to time.)

Note that the arguments to "binding" are processed in parallel and cannot refer to each other. They are established and released in a group using a map internally. If the syntax were also a map, it would be a good cue that they are not handled the same way as in Clojure's (current) let.

--Steve

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to