Add another simple destructuring example.
This commit is contained in:
parent
e10fc56c2c
commit
98b7ab99fe
@ -34,6 +34,7 @@ partition-by
|
||||
rand-nth
|
||||
range
|
||||
reductions
|
||||
constantly
|
||||
repeatedly
|
||||
shuffle
|
||||
|
||||
|
@ -1,4 +1,11 @@
|
||||
(meditations
|
||||
"Destructuring allows you to break up arguments"
|
||||
"Destructuring is an arbiter: it breaks up arguments"
|
||||
(= __ ((fn [[a b]] (str b a))
|
||||
[:foo :bar])))
|
||||
[:foo :bar]))
|
||||
|
||||
"Whether in function definitions"
|
||||
(= "First comes love, then comes marriage, then comes Clojure with the baby carriage"
|
||||
((fn [[a b c]] __)
|
||||
["love" "marriage" "Clojure"]))
|
||||
|
||||
)
|
||||
|
@ -96,7 +96,8 @@
|
||||
acc
|
||||
(recur (dec n) (* acc n))))]
|
||||
"___" ['not]}
|
||||
"destructuring" {"__" ["\":bar:foo\""]}
|
||||
"destructuring" {"__" ["\":bar:foo\""
|
||||
'(format "First comes %s, then comes %s, then comes %s with the baby carriage" a b c) ]}
|
||||
})
|
||||
|
||||
(defn replace-with [s k replacements]
|
||||
|
Loading…
Reference in New Issue
Block a user