On Apr 16, 5:25 pm, Asim Jalis <asimja...@gmail.com> wrote:
> > It does conform to the pattern that the bound variable precedes the
> > value to bind in forms like let. A benefit of this ordering is that
> > destructuring patterns like {:keys [a b c]} are unambiguous.
>
> Hi Per,
>
> Could you explain the rationale for this swapping? Intuitively it
> seems to me that (let [{ :body x } { :body 42 }] x) should bind x
> to 42 -- it seems intuitive because it is binding :body to :body
> and 42 to x.
>
> I realize that this doesn't work. I want to understand why. Why
> is (let [{ x :body } { :body 42 }] x) the correct way?
>
> Asim

I think the paragraph you replied to *is* the rationale: it allows for
features like :keys and :or, and maintains the general ordering of
bindings. It may feel a bit unintuitive at first, but I think that's
only because you're associating the map binding form more closely to a
map (a collection of key–value pairs) than a binding form.

-- 
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