Recursion or iteration?

Are they more expensive than
iterations?

Yes they are. Many Lisp variants support the idea of a “tail-call optimisation” which allows many uses of a recursive function call to be converted into an iterative one (this is simplifying a bit). If tail-call is not supported, then a recursive function call will use progressively more memory on the stack.

Leave a Comment