Skip to content

Commit

Permalink
added support for associative destrucuring for seqs by pouring them i…
Browse files Browse the repository at this point in the history
…nto a map first, thus supporting associative destruring of & args
  • Loading branch information
richhickey committed Mar 23, 2010
1 parent 67864eb commit 2938997
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/clj/clojure/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -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))

This comment has been minimized.

Copy link
@chung

chung Mar 26, 2010

test

(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))
Expand Down

1 comment on commit 2938997

@devn
Copy link

@devn devn commented on 2938997 Mar 27, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.