[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RFC: major change to argument processing.
From: |
Marius Vollmer |
Subject: |
Re: RFC: major change to argument processing. |
Date: |
03 Jun 2001 00:55:59 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.0.102 |
Rob Browning <address@hidden> writes:
> More seriously, I'll have to think about this. If recursion, even
> when tail recursive, really is that much more expensive than other
> approaches, then I should probably start adjusting my assumptions and
> coding practices.
Ahh, no. I only meant non-tail-recursion. Tail-recursing is fine.
> In the long run, if there are things we can to do make recursion
> faster/more efficient, then I think they're probably important.
I don't think recursion is particularly expensive with Guile. No need
to avoid recursion if it is otherwise a natural way to express an
algorithm.
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.
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.
- Re: RFC: major change to argument processing., (continued)
- Re: RFC: major change to argument processing., Marius Vollmer, 2001/06/01
- Re: RFC: major change to argument processing., Rob Browning, 2001/06/01
- Re: RFC: major change to argument processing., Marius Vollmer, 2001/06/01
- Re: RFC: major change to argument processing., Rob Browning, 2001/06/02
- Re: RFC: major change to argument processing., Marius Vollmer, 2001/06/02
- Re: RFC: major change to argument processing., Rob Browning, 2001/06/02
- Re: RFC: major change to argument processing., Marius Vollmer, 2001/06/02
- Re: RFC: major change to argument processing., Rob Browning, 2001/06/02
- Re: RFC: major change to argument processing.,
Marius Vollmer <=
- Re: RFC: major change to argument processing., Rob Browning, 2001/06/02
Re: RFC: major change to argument processing., Rob Browning, 2001/06/01