The simplest way I see is
(apply merge (filter identity '({:apple "red and crunchy"} nil nil {:Numb
1} nil nil {:Field "FRUIT.Description"})))
results in
{:Field "FRUIT.Description", :Numb 1, :apple "red and crunchy"}
On Mon, Jul 8, 2013 at 6:01 PM, VaedaStrike <[email protected]>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 [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
> ---
> 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 [email protected].
> 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 [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
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.