[Top][All Lists]

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

Re: Help with recursive destructive function

From: Eric Abrahamsen
Subject: Re: Help with recursive destructive function
Date: Sun, 06 May 2018 20:01:02 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> Eric Abrahamsen <address@hidden> writes:
>> Oh hang on, this doesn't work for all cases: the "by #'cdr" prevents
>> it from hitting the cdr of cons cells:
>> (let ((tree '("c" (2 ("d" . 3)) (4 . "e") "f")))
>>   (iter-do (_ (iter-tree-example tree)))
>>   tree)
>> --> ("C" (2 ("D" . 3)) (4 . "e") "F")
> Not only that (it's easy to fix), but I also realized that this approach
> doesn't circumvent the recursion issue.  But if your data is not
> extremely deeply nested, recursion should not be such a problem.

Well... but... it might be deeply nested...

I'd like to have an iterative approach to work with as well -- it may
end up being slower, but if it's only a little slower, the slow-down is
worth the safety. If you have nothing to do on a Sunday afternoon (here)
and want to contribute a non-recursive iterative version, I would look
forward to testing!

Just saying,

reply via email to

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