You should get familiar with the "syntax" of "if", comment and other basic
things in Clojure:

(defn boolean [x]
  (if (or (false? x) (nil? x))
      false
      true))
;; this is a comment
;; you should use Clojure's built-in "boolean" instead of define your own

(defn abs [x]
  (if (< x 0)
    (- x)
    x))
;; you could use Math/abs instead

(defn teen? [age]
  (< 12 age 20))
;; here the "if" **form** is not needed, not the "if" symbol/macro

2014-04-23 18:45 GMT+08:00 Roelof Wobben <rwob...@hotmail.com>:

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




Regards,
Xu Hui Hui

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