Thanks, 

But something is not going right.

When delete the if as you said and have this : 

(defn boolean [x]
  (or (false? x)(nil? x))
      false;
      true)

(defn abs [x]
  (< x 0)
    (* x -1);
    x)

(defn teen? [age]
  (< 12 age 20)
      true;
      false)

Then all tests fail and if I put a if before it , they all work well. 

Roelof

Op woensdag 23 april 2014 12:19:01 UTC+2 schreef James Reeves:

> (< a b c) is equivalent to (and (< a b) (< b c)), so yes, (< 12 age 20) is 
> the same as 12 < age < 20.
>
> You could write your function more concisely as:
>
> (defn teen? [age]
>   (< 12 age 20))
>
> The "if" statement is unnecessary.
>
> - James
>
>
> On 23 April 2014 11:11, Roelof Wobben <rwo...@hotmail.com <javascript:>>wrote:
>
>> Hello, 
>>
>> I do not understand why this work.
>>
>> I have to check if someone is between 12 and 20 years.
>>
>> So after some trail and error this seems to work
>>
>> (defn teen? [age]
>>   (if (< 12 age 20)
>>       true;
>>       false))
>>
>> Is it right it stated 12 < age <  20 ?
>>
>> 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