oke, 

Then I have to fnd another way to see how many times a number is present in 
a collection.
I thought count  could do that.

Roelof


Op vrijdag 9 mei 2014 20:24:29 UTC+2 schreef James Reeves:

> Your function is essentially:
>
>     (= (map count coll) 1)
>
> So you're applying the function "count" to each element in the collection. 
> Let's say your collection is:
>
>     [1 2 3]
>
> Then you're trying to evaluate:
>
>     [(count 1) (count 2) (count 3)]
>
> Clojure is raising an exception that says "I can't count a number, I can 
> only count collections".
>
> - James
>
>
> On 9 May 2014 17:42, Roelof Wobben <rwo...@hotmail.com <javascript:>>wrote:
>
>> I try to make this assigment : 
>>
>> Write the function (contains-duplicates? sequence) that takes a sequence 
>> as a parameter and returns true if sequence contains some element 
>> multiple times. Otherwise it returns false.
>>
>> So I did this : 
>>
>> (defn contains-duplicates? [a-seq]
>>   (let [element (fn element [a-seq] (count a-seq) )]
>>      (= (map element a-seq)1)))
>>
>> But then I see this message : UnsupportedOperationException count not 
>> supported on this type: Long  clojure.lang.RT.countFrom (RT.java:556)
>>
>> When I change map to apply I see this message : ArityException Wrong 
>> number of args (5) passed to: 
>> structured-data$contains-duplicates-QMARK-$element  
>> clojure.lang.AFn.throwArity (AFn.java:437)
>>
>> Where did I misunderstood this page : 
>> http://iloveponies.github.io/120-hour-epic-sax-marathon/structured-data.html
>>
>> Roelof
>>
>>  -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <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 clojure+u...@googlegroups.com <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 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
--- 
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 clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to