Show pageOld revisionsBacklinksBack to top This page is read only. You can view the source, but not change it. Ask your administrator if you think this is wrong. # Destructuring [[Destructuring]] allows us to conveniently bind elements of collections to symbols <code clojure> (def s [1 2 3]) ;with destructuring (let [[x y] s] (do-stuff x y)) ; (do-stuff 1 2) </code> <code clojure> (def s [1]) ;with destructuring (let [[x y z] s] (do-stuff x y z)) ; (do-stuff 1 nil nil) </code> <code clojure> (def m {:y 3 :x 8 :z -5}) ;with destructuring (let [{:keys [x z]} m] (do-stuff x z)) ; (do-stuff 8 -5) </code> open/destructuring.txt Last modified: 2024/10/05 06:15by 127.0.0.1