I am confused about something. I wanted to generate an example (in Clojure) demonstrating how a fixed point combinator could be used to evaluate the fixed point of a sequence that mathematically converges after an infinite number of applications but would, in fact, converge after a finite number of steps due to finite precision of floating points. I am apparently missing something here.
(defn Y [r]
((fn [f] (f f))
(fn [f]
(r (fn [x] ((f f) x))))))
(defn simple-convergent [func]
(fn [x]
(if (zero? x)
0.0
(* 0.5 (func x)))))
I can then get
user=> ((Y simple-convergent) 0.)
0.0
user=> ((Y simple-convergent) 0.2)
java.lang.StackOverflowError (NO_SOURCE_FILE:0)
I don't understand this stack overflow. More generally, related to my earlier post, I am wondering if someone can present a "correct" version of a fixed point combinator which can be used to approximate fixed points of sequences in this fashion.