Daniel Werner <[email protected]> writes:
> After a few tries I've come up with the following algorithm to
> transform :keys syntax into normal destructuring syntax, but am still
> appalled by its complexity:
>
> (let [vmap {'y :y, 'z :z :keys ['a 'b]}]
> (->> vmap
> ((juxt :keys :strs :syms))
> (apply concat)
> (mapcat #(vector % (keyword %)))
> (apply hash-map)))
>
> ==> {a :a, b :b}
Pretty's such a subjective thing, but my first impulse was:
(let [vmap {'y :y, 'z :z :keys ['a 'b]}]
(reduce #(assoc %1 %2 (keyword %2))
{}
(mapcat vmap [:keys :strs :syms])))
--
Mark Triggs
<[email protected]>
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en