Browse files

added support for associative destrucuring for seqs by pouring them i…

…nto a map first, thus supporting associative destruring of & args
  • Loading branch information...
1 parent 67864eb commit 29389970bcd41998359681d9a4a20ee391a1e07c @richhickey committed Mar 23, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/clj/clojure/core.clj
@@ -3012,7 +3012,8 @@
(fn [bvec b v]
(let [gmap (or (:as b) (gensym "map__"))
defaults (:or b)]
- (loop [ret (-> bvec (conj gmap) (conj v))
+ (loop [ret (-> bvec (conj gmap) (conj v)
+ (conj gmap) (conj `(if (seq? ~gmap) (apply hash-map ~gmap) ~gmap)))
bes (reduce
(fn [bes entry]
(reduce #(assoc %1 %2 ((val entry) %2))

1 comment on commit 2938997

devn commented on 2938997 Mar 27, 2010

May we have an example of what this allows? There has been some confusion about the ability to destructure maps in #clojure the last few days and it would be nice to see what this means when applied.

Please sign in to comment.