On Thu, Jun 16, 2011 at 9:51 AM, Tassilo Horn tass...@member.fsf.org wrote:
Hi all,
I have some functions that use destructuring on a map parameter, and it
seems I have a false assumption on the workings. Take for example this
one:
(defn foo
[{:keys [a b]
:or {a 1 b 2}
:as all}]
Ken Wesson kwess...@gmail.com writes:
Hi Ken!
That somehow makes sense, but is there some way to get the complete
map with defaults applied, too?
(defn foo
[{:keys [a b]
:or {a 1 b 2}
:as all}]
(let [all (merge {:a 1 :b 2} all)]
[(hash-map :a a :b b) all]))
Of course
On Fri, Jun 17, 2011 at 2:31 PM, Tassilo Horn tass...@member.fsf.org wrote:
Ken Wesson kwess...@gmail.com writes:
Hi Ken!
(defmacro defnm [name argvec body]
`(defn ~name ~argvec
(let ~(vec
(apply concat
(for [a argvec :when (and (map? a) (:or a) (:as
Hi all,
I have some functions that use destructuring on a map parameter, and it
seems I have a false assumption on the workings. Take for example this
one:
(defn foo
[{:keys [a b]
:or {a 1 b 2}
:as all}]
[(hash-map :a a :b b) all])
I expected it to always return a vector of two