I think the definition of as-> should be changed to this. I feel this
behavior is more consistent with the rest of clojure.

(defmacro as-> [expr name & forms] `(let [~name ~expr ~@(interleave (repeat
name) (take (dec (count forms)) forms))] ~(last forms))

Thanks,
Sunil

On Mon, Sep 29, 2014 at 2:11 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hi everybody,
>  I get the following when I try to use the as-> macro
>
>
> user=> (def x (as-> {:a 10 :b 20} {:keys [a b] :as w}  {:a (* 2 a) :b (* 2
> b)}))
> #'user/x
> user=> x
> {:keys [20 40], :as {:a 20, :b 40}}
> user=>
>
> I would have expected x to be {:a 20 :b 40}, not what I see above.
>
> Can somebody explain?
> Thanks,
> Sunil.
>

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to