Hi everyone,
let's play a round of golf. I am currently implementing associative
destructuring for ClojureJS while trying not to peek into clojure.core
too often -- which wouldn't make things much easier since the
'destructure fn is a huge beast.
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}
There has got to be a prettier/more efficient way! I'm open to
suggestions :-)
Thanks,
Daniel
--
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