User talk:Watmough

Jonathan's Ideas
Mainly ideas and retracted edits on the Clojure_Programming page.

Mutual Recursion
Mutual recursion is tricky in Clojure since there is a limited form of (def ...) than allows the body of a function to refer to itself only.

However, Clojure does allow dynamic redefinition of function bindings, allowing the following:


 * Mutual recursion example

(def odd? (fn [] nil)) (def even? (fn [] nil))
 * forward declarations

(def odd? (fn [n] (if (= n 0)     false      (even? (- n 1)))))
 * define odd in terms of 0 or even

(def even? (fn [n] (if (= n 0)     true      (odd? (- n 1)))))
 * define even? in terms of 0 or odd

(even? 3)
 * Is 3 even or odd?

user=> (even? 3) false

Welcome
Come introduce yourself at the new users page. If you have any questions, you can ask there or contact me personally.--Whiteknight (Page) (Talk) 02:23, 11 February 2008 (UTC)