woops, merge is indeed the function you're after

2010/6/2 Laurent PETIT <laurent.pe...@gmail.com>

> Hi,
>
> 2010/6/1 Ryan <ryg...@gmail.com>
>
>> I have the following
>>
>> user=> (class ({:one "1"} {:two "2"} {:three "3"}))
>> clojure.lang.PersistentArrayMap
>>
>> but am a little confused as to how best to access the data
>>
>> for example:
>> user=> (count ({:one "1"} {:two "2"} {:three "3"}))
>> 1
>>
>
> try directly in the REPL ({:one "1"} {:two "2"} {:three "3"})
> I guess you should get
> {:three "3"}
>
> because you're not defining a list of maps, you're calling a map by key.
> The called map is {:one "1"}, the key provided to the call is {:two "2"},
> and you also provide a default value as well: {:three "3"}
> !
>
>
>> user=> (first ({:one "1"} {:two "2"} {:three "3"}))
>> [:three "3"]
>> user=> (last ({:one "1"} {:two "2"} {:three "3"}))
>> [:three "3"]
>>
>> what I really want is something like this:
>> user=> (conj {:one "1"} {:two "2"} {:three "3"})
>> {:three "3", :two "2", :one "1"}
>>
>>
> You want assoc, or into.
>
>
>> Can someone possibly explain what I am misunderstanding about
>> ArrayMaps so I can fill in some of my knowledge gaps?
>>
>>
> Nothing specific to ArrayMaps. It's implementation detail.
>
>

-- 
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

Reply via email to