Re: [TADS] Moving stuf again...


Sun, 10 Dec 1995 09:24:08 -0500

On 9 Dec 1995 23:40:52 -0500, ersatzpogo@aol.com (ErsatzPogo) wrote:
>Thanks, guys, but actually Dan Shiovotz beat you both to it via e-mail
>with this nifty bit of code:
>
>moveFromTo: function (from, to)
>{
> local l, i;
> l := from.contents;
> for (i := 1; i <= length(l); ++i)
> {
> l[i].moveInto(to);
> }
>}
>
>Same concept as the other suggestions, except that I actually understand
>it (sorta, kinda...).

What didn't you understand in my code?

You could speed up this code by adding another local variable len :=
length(l) so you don't have to call length() every iteration to
recalculate the same number over and over. That would probably make it
more efficient than my code, which calls cdr() every iteration.

--
Carl (ravenpub@southwind.net)
* Ignoramus? I prefer the term "informationaly impaired"