Hi all,

>> 1) Does the Interpretor do any kind of tail call optimisation, I
>
> No, not at all.
>
> As far as I can see, this is not easy to implement in an efficient way.
> The interpreter would have to detect tail recursion at runtime, which
> takes much more than time than simply executing the call/return. Each
> function must inspect itself, just to find those (extremely few) cases
> of tail recursion.
>
> Above that, it would violate some basic principles of picoLisp. Trying
> to be clever behind the scenes, doing things the programmer did not
> explicitly specify, losing simplicity and what-you-see-is-what-you-get.
>
> Tail recursion is nothing more than a simple loop. So we might better
> write directly what we mean, using 'while', 'for', 'loop' etc.

there is a way around not having tail call optimisation even though it
is not very intuitive.  I just put some code on
http://logand.com/picoWiki/trampoline so feel free to comment on it.

Thanks,

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

Reply via email to