Sunday, 15 January 2012

clojure / lisp dialect etc function result expression -



clojure / lisp dialect etc function result expression -

are able have multiple expressions in clojure function.

below example.

(defn side-effect-add [a b] (println "doing side effect") (+ 1 2) (+ b) )

is ok or function allowed have / homecoming result of single look in body.

thanks.

this valid clojure.

of sequence of expressions/forms , function returns value of last. others have side-effects, such (println ...) above. a function body has implicit do bring about.

clojure

No comments:

Post a Comment