Finish off vector destructuring features.

This commit is contained in:
Colin Jones
2010-11-08 18:07:59 -06:00
parent 98b7ab99fe
commit af19d14c40
2 changed files with 29 additions and 3 deletions

View File

@@ -4,8 +4,21 @@
[:foo :bar]))
"Whether in function definitions"
(= "First comes love, then comes marriage, then comes Clojure with the baby carriage"
(= (str "First comes love, "
"then comes marriage, "
"then comes Clojure with the baby carriage")
((fn [[a b c]] __)
["love" "marriage" "Clojure"]))
"Or in let expressions"
(= "Rich Hickey aka The Clojurer aka Go Time aka Macro Killah"
(let [[first-name last-name & aliases]
(list "Rich" "Hickey" "The Clojurer" "Go Time" "Macro Killah")]
__))
"You can regain the full argument if you like arguing"
(= {:original-parts ["Steven" "Hawking"] :named-parts {:first "Steven" :last "Hawking"}}
(let [[first-name last-name :as full-name] ["Steven" "Hawking"]]
__))
)