These are both very good and usable answers. Thank you both!
On Sunday, June 1, 2014 9:36:58 AM UTC-7, James Reeves wrote:
>
> 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 <[email protected] <javascript:>> 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 [email protected]
>> <javascript:>
>> 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] <javascript:>
>> 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] <javascript:>.
>> 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 [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/d/optout.