(< 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 <[email protected]> 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 [email protected] > Note that posts from new members are moderated - please be patient with > your first post. > To unsubscribe from this group, send email to > [email protected] > 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 [email protected]. > 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 [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/d/optout.
