(defn argcount
;;zero arguments
([] 0)
;; 1 argument
([x] 1)
;; list of arguments
([ x & args] (inc (count args))))
no if then statements, this is defining a function lazily, it only grabs the definition that it needs pretty neat.
This language is a very functional language much like SML. Here’s another example of a function being defined on one line
(def newton (iterate (fn[x] (/ (+ x (/ 2.0 x)) 2)) 2))
Here is an example of a for loop which cannot be done in SML. I like Clojure better already
Add a comment