I got it, guys! Thanks a lot! This non-tailrecursive version works as intended:
(defn fix2 [f x] (let [y (f x)] (eval ({x x} y (list 'fix2 f y))))) Dominikus Am Freitag, 27. April 2012 17:00:52 UTC+2 schrieb Luke VanderHart: > > Using a map instead of if means that it is evaluated as a function call. > Unlike the if form, function calls eval their arguments. So the (recur) > form is getting eval'd prior to being passed to the map/function, which > isn't a tail position. > > That's why "if" is a special form/macro, not a regular function (like maps > are). > > On Friday, April 27, 2012 10:52:10 AM UTC-4, Dominikus wrote: >> >> Sure? The semantics of the default value corresponds to a 'if', doesn't >> it? From this viewpoint, the default value is in tail position. And why >> does the non-tailrecursive version not run as expected? >> >> Dominikus >> >> >> Am Freitag, 27. April 2012 16:45:44 UTC+2 schrieb Meikel Brandmeyer >> (kotarak): >>> >>> Hi, >>> >>> (defn fix2 [f x] (let [v (f x)] ({x x} v (recur f v)))) >>> >>> recur is not in the tail position. The "call" to the map is the tail >>> call. So the result is as expected. >>> >>> Kind regards, >>> Meikel >>> >>> -- 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