What about:

{:fullname (get result 0), :lastname (get result 1), :firstname (get result
2), :middlename (get result 3)}

If the "get" function can't find a result, it returns nil.

- James


On 1 June 2014 17:09, Glen Rubin <rubing...@gmail.com> wrote:

> I am doing some text processing using clojure and attempting to extract a
> person's name by regex and then assign it to a map.  The result I get takes
> one of several forms:
>
> nil (if i can't find the name)
>
> [fullname]
>
> [fullname lastname]
>
> [fullname lastname firstname]
>
> [fullname lastname firstname middlename]
>
> now, basically want to assign these entries to a map like so {:fullname
> "some name", :lastname "some name", etc...}
>
> if there is no entry than I would like to assign it as nil, e.g.
> {:fullname nil, lastname nil, etc...}
>
> I want to code this in the most proper way.  I am thinking I need to
> define a function that works differently based on how long the vector is?
> How do I turn the contents of the vector into function arguments?
>
> Thanks!
>
>  --
> 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/d/optout.
>

-- 
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/d/optout.

Reply via email to