Hi Karl,
2009/8/31 Krukow <[email protected]>:
> 2) I can do:
> user> (into {} '([:k :v]))
> {:k :v}
>
> This works for two-element vectors. However, I cannot do the same for
> two-element arrays:
>
> user> (def str_array (.split "k=v" "="))
> #'user/str_array
> user> (into {} (list str_array))
> ; Evaluation aborted.
>
<snip>
>
> The use-case arose from wanting to create a map from a properties file
> using split ("=") on each line of the properties file (and not wanting
> to copy the array into []).
I just wanted to point out that the Java Properties class inherits
Hashtable which is already (into) compatible, i.e.
user> (let [props (. System getProperties)]
((into {} props) "os.arch"))
"x86"
--
! Lauri
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---