Re: Implementing destructuring without setting your hair on fire

2011-02-16 Thread Daniel Werner
On Jan 22, 1:19 am, Mark Triggs mark.h.tri...@gmail.com wrote: Daniel Werner daniel.d.wer...@googlemail.com 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

Re: Implementing destructuring without setting your hair on fire

2011-02-16 Thread Meikel Brandmeyer
Hi, user= (let [vmap '{y :y z :z :keys [a b] :syms [e f] :strs [g h]}] (- (dissoc vmap :keys :strs :syms) (into (map #(vector % (keyword %)) (:keys vmap))) (into (map #(vector % (name %))(:strs vmap))) (into (map #(vector % %) (:syms vmap) {y :y, z :z, a :a, b :b,

Implementing destructuring without setting your hair on fire

2011-01-21 Thread Daniel Werner
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

Re: Implementing destructuring without setting your hair on fire

2011-01-21 Thread Mark Triggs
Daniel Werner daniel.d.wer...@googlemail.com 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