Re: Iterating over generic sequences.
- From: Pillsy <pillsbury@xxxxxxxxx>
- Date: Wed, 26 Sep 2007 16:48:54 -0700
On Sep 26, 6:32 pm, Kent M Pitman <pit...@xxxxxxxxxxx> wrote:
Pillsy <pillsb...@xxxxxxxxx> writes:[...]
1. Using ELT with LOOP or DOTIMES (which seems needlessly inefficient,
especially for lists). The upside is that it's very simple.
It's also potentially O(n^2) since ELT is O(n) for lists. You do not
want to use ELT for much of anything, but most certainly you do not want
to use it for iterating across a list.
Yeah. That's the reason I never use it, but I never use it, so I
forgot why I never use it. :-/
Pascal wrote a solution to this, so I won't repeat that. But I just don't
see why you expect this to be better than a nice pretty call to MAP
(optionally abstracted into some other calling sequence if you know some
additional fact about return value or whatever that allows you to simplify
its notation further).
The main thing that started me thinking in that direction is probably
that I was doing something where I wanted to use LOOP (and drive
multiple variables at once and do some of the other LOOPy stuff),
which tends to be pretty awkward when you're using MAP. Then I wrote
an example that totally failed to capture that.
I also find it pretty helpful to have my misguided gut feelings
thoroughly refuted.
Cheers,
Pillsy
.
- References:
- Iterating over generic sequences.
- From: Pillsy
- Re: Iterating over generic sequences.
- From: Kent M Pitman
- Iterating over generic sequences.
- Prev by Date: Re: what do you think of this macros and functions?
- Next by Date: Re: Lisp and OCaml
- Previous by thread: Re: Iterating over generic sequences.
- Next by thread: Re: Note Scheme related but a question to wget and ftp servers
- Index(es):
Relevant Pages
|
|