2010/11/1 tonyl celtich...@gmail.com:
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)
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 r...@lysator.liu.se wrote:
2010/11/1 tonyl celtich...@gmail.com:
I was wondering since it uses the dispatch macro and AFAIK
there is no api fn to create
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
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
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 celtich...@gmail.com 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
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
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 kumar.shant...@gmail.com 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