Yes, that wasn't very clear of me. Here is what I was thinking when writing
that.
In Scheme, which has general tail-call optimization, you will often find
functions written where the programmer went out of their way to change it from
recursive, but doesn't use tail calls, into something that r
On Mon, Nov 19, 2012 at 6:24 PM, Andy Fingerhut
wrote:
> Clojure's loop/recur only implements tail recursion, not general tail-call
> optimization. tail recursion is far more commonly used in languages that
> have it than the general tail-call optimization to arbitrary functions.
Can you explain
On Nov 27, 2012, at 8:17 PM, Curtis wrote:
> Thank you Andy - This was fabulously helpful - I really appreciate your
> explanation.
>
> Would you permit me to include your answer in a blog post about the above
> question?
Sure, use it however you like.
Andy
--
You received this message b
On 11/27/12 9:17 PM, Curtis wrote:
Thank you Andy - This was fabulously helpful - I really appreciate
your explanation.
Would you permit me to include your answer in a blog post about the
above question?
On Monday, November 19, 2012 6:25:30 PM UTC-8, Andy Fingerhut wrote:
If you are f
Thank you Andy - This was fabulously helpful - I really appreciate
your explanation.
Would you permit me to include your answer in a blog post about the above
question?
On Monday, November 19, 2012 6:25:30 PM UTC-8, Andy Fingerhut wrote:
>
> If you are familiar with tail recursion, then loop/
If you are familiar with tail recursion, then loop/recur this is Clojure's way
to achieve tail recursion.
http://en.wikipedia.org/wiki/Tail_call
The general tail call optimization mechanism as implemented in the programming
language Scheme, for example, means that tail-position calls must not c
Clojure Koans - Recursion
(defn recursive-reverse [coll]
(loop [coll coll
acc '() ]
(if (= (count coll) 0)
acc
(recur (rest coll) (cons (first coll) acc))
)
)
)
I struggled with this one for a while - I don’t want to admit it, but
honestly even though i have