Into is reduce-conj, and this relies on a special-case of conj for maps and map entries. I find it hard to read, so I would vote for apply/reduce merge.
This is weird and unexpected, so please don't: user> (into {:c :d} [{:a :b}]) {:c :d, :a :b} user> (into {:c :d} {:a :b}) {:c :d, :a :b} On Mon, Jul 8, 2013 at 12:30 PM, Max Penet <m...@qbits.cc> wrote: > You don't need apply, you can just use into: > > user> (into {} [{:apple "red and crunchy"} nil nil {:Numb 1} nil nil > {:Field "FRUIT.Description"}]) > {:apple "red and crunchy", :Numb 1, :Field "FRUIT.Description"} > > On Monday, July 8, 2013 5:01:20 PM UTC+2, VaedaStrike wrote: >> >> So I have data structure that's equivalent to the following— >> >> ({:apple "red and crunchy"} nil nil {:Numb 1} nil nil {:Field >> "FRUIT.Description"}) >> >> and I'm trying to combine the maps into a single map and I'm just being >> flummoxed >> >> I tried destructuring it and then applying a merge to the maps while not >> touching the 'nil's but I'm not getting that to work, here's the code I >> tried— >> >> >> (def sequ ({:apple "red and crunchy"} nil nil {:Numb 1} nil nil {:Field >> "FRUIT.Description"})) >> ::The above is just representing the structure I get from a previous >> parse function. >> ;; If there's a way to alter this so it works with what I'm trying to do >> please >> ;; let me know, or if I'm just doing it all wrong let me know as well!! >> >> >> (defn extract-n-merge-map [sequ] >> (let [(a _ _ b _ _ c) sequ] >> (merge a b c))) >> >> ;; This is giving me "unsupported binding form: (a _ _ b _ _ c) at line >> ..." >> >> Basically I'm using instaparse to take a block of code in another >> language and trying to automate it's transformation to a new format. >> >> I thought that parsing out and taging it's components in a map would give >> me an overall process that would make other such >> automatons in the future much easier, but since this is my first attempt >> at using clojure to do something productive I'm just >> riddled with noobness and it's just getting so frustrating to have gotten >> this far and not being able to figure out how to get over the >> last hump. >> > -- > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > --- > You received this message because you are subscribed to the Google Groups > "Clojure" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clojure+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.