guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: major change to argument processing.


From: Rob Browning
Subject: Re: RFC: major change to argument processing.
Date: 02 Jun 2001 18:47:33 -0500
User-agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.7

Marius Vollmer <address@hidden> writes:

> If your algorithm makes use of a stack-like data-structure, you can
> just as well use the call stack for it.  Like tree-walking: you have
> to code your own stack if you want to avoid recursion.  Unlike
> computing the factorial: the algorithm does not need a stack, and
> coding it recursively (which might seem natural at first) will use
> space linear with the argument, while the iterative version
> (i.e. tail-recursing) runs in constant space.

Agreed.

> In our case, consing up a list, we already need space linear with
> the number of recursions (or iterations), so we can only gain a
> constant factor when not using the stack.  Sometimes this is worth
> it, sometimes not.

Makes sense.

Thanks

-- 
Rob Browning <address@hidden> PGP=E80E0D04F521A094 532B97F5D64E3930



reply via email to

[Prev in Thread] Current Thread [Next in Thread]