Chips I thought I understand it 
But this does not work 

(defn divides? [divisor n]
  (mod n divisor))

I still get a cannot be cast error message.

Roelof


Op woensdag 23 april 2014 14:32:41 UTC+2 schreef Roelof Wobben:

>
>
> Op woensdag 23 april 2014 14:26:14 UTC+2 schreef Tassilo Horn:
>>
>> Roelof Wobben <rwo...@hotmail.com> writes: 
>>
>> > The only thing which is failing now is this one ; 
>> > 
>> > (defn abs [x] 
>> >   (< x 0) 
>> >     (* x -1); 
>> >     x) 
>> > 
>> > I keep getting -2 as answer where it must be 2 
>>
>> Well, the function contains three forms where the results of the first 
>> two are ignored and only the value of the last one is returned.  So here 
>> you need an `if`. 
>>
>>   (defn abs [x] 
>>     (if (< x 0) 
>>       (* x -1) 
>>       x)) 
>>
>> Bye, 
>> Tassilo 
>>
>> BTW: Why do you have those semicolons in your code?  That ends a 
>> statement in C-like languages but in Lisps including Clojure it starts a 
>> comment spanning till the end of the line. 
>>
>
>
> oke, 
> So if I understand everything well when I want true or false I do not need 
> a if . In all other cases I need a if.
> Regarding the ; I thought I was a divider between the then and the else 
>
> Roelof 
>

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