Except when they are small enough to conveniently be array-maps:
user=> (class (into {} (zipmap (range) (range 8
clojure.lang.PersistentArrayMap
user=> (class (into {} (zipmap (range) (range 9
clojure.lang.PersistentHashMap
But those behave just like hash-maps, so you can ignore the
diffe
Wow, this brings more light to the subject. Thank you guys for your
explanations and practical uses.
On Nov 2, 1:31 am, Rasmus Svensson wrote:
> 2010/11/1 tonyl :
>
> > I was wondering since it uses the dispatch macro and AFAIK
> > there is no api fn to create them like hash-maps to create maps,
2010/11/1 tonyl :
> I was wondering since it uses the dispatch macro and AFAIK
> there is no api fn to create them like hash-maps to create maps,
> vector/vec for vectors, or list for lists.
There are parallels to 'hash-map' and 'sorted-map' in the api:
user=> (hash-set :a :b :c)
#{:a :c :b}
user
Or just this:
user=> (set [1 2 3 4 5 8 8 9 6 6 4])
#{1 2 3 4 5 6 8 9}
On Nov 1, 8:11 am, Shantanu Kumar wrote:
> You can write something like this:
>
> user=> (into #{} [1 2 3 4 5 8 8 9 6 6 4])
> #{1 2 3 4 5 6 8 9}
>
> Cheers,
> Shantanu
>
> On Nov 1, 7:55 am, tonyl wrote:
>
>
>
>
>
>
>
> > I g
>From a mathematical perspective the essential aspect of a set is its
>extension, namely what elements are contained in the set. This leads
>immediately to the property of uniqueness you mentioned. But the fundamental
>operation is 'contains?'. In other words, does the set contain some object or
You can write something like this:
user=> (into #{} [1 2 3 4 5 8 8 9 6 6 4])
#{1 2 3 4 5 6 8 9}
Cheers,
Shantanu
On Nov 1, 7:55 am, tonyl wrote:
> I guess I should've look harder (and ask more in the irc ;) it is a
> data structure and has a set fn too. #{} is just a reader macro for
> syntacti
I guess I should've look harder (and ask more in the irc ;) it is a
data structure and has a set fn too. #{} is just a reader macro for
syntactic sugar. And the difference of usage between sets and vectors
are they sets can't have duplicates.
This is great, clojure group with irc chat, good learnin
I've been wondering if sets are actually a defined data structure like
vectors and maps or are they a result of an expansion of the dispatch
macro? I was wondering since it uses the dispatch macro and AFAIK
there is no api fn to create them like hash-maps to create maps,
vector/vec for vectors, or