2010-11-06 22:38:31 +00:00
|
|
|
(meditations
|
2010-11-08 23:27:18 +00:00
|
|
|
"Destructuring is an arbiter: it breaks up arguments"
|
2010-11-06 22:38:31 +00:00
|
|
|
(= __ ((fn [[a b]] (str b a))
|
2010-11-08 23:27:18 +00:00
|
|
|
[:foo :bar]))
|
|
|
|
|
|
|
|
"Whether in function definitions"
|
2010-11-09 00:07:59 +00:00
|
|
|
(= (str "First comes love, "
|
|
|
|
"then comes marriage, "
|
|
|
|
"then comes Clojure with the baby carriage")
|
2010-11-08 23:27:18 +00:00
|
|
|
((fn [[a b c]] __)
|
|
|
|
["love" "marriage" "Clojure"]))
|
|
|
|
|
2010-11-09 00:07:59 +00:00
|
|
|
"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"]]
|
|
|
|
__))
|
|
|
|
|
2010-11-08 23:27:18 +00:00
|
|
|
)
|