Tomas Hlavaty <t...@logand.com> writes:

Hi Tomas,

>> The notion of 'tail-recursion' does not have any meaning in an
>> interpreted language like PicoLisp, since its only for compiler
>> optimizations -right?
>
> I think you are confusing the terms.  What you are probably after is
> called tail call optimisation (TCO), which is an optimisation that can
> be applied to tail calls.

tail-recursion is definitely one way to name it, there are a lot of
usage examples around, e.g.

,--------------------------------------------------
| http://www.haskell.org/haskellwiki/Tail_recursion
`--------------------------------------------------

but TCO might be a more accurate term, or lets put it like this - many
books about compiled languages state that tail-recusrion is important
because it enables TCO. 

> There are interpreters that require TCO, e.g. PostScript.  In my
> JavaScript implementation of PostScript
> <http://logand.com/sw/wps/index.html>, I used trampoline to implement it
> http://logand.com/picowiki.html#sec-14 and optimize stack growth.  As
> shown in the examples, one can use the technique in PicoLisp too,
> althought it doesn't compose well.

nice example, thanks for the link!

-- 
cheers,
Thorsten

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to