emacs-devel
[Top][All Lists]
Advanced

[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: Wed, 06 Jun 2018 17:49:43 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On 06/07/18 01:30 AM, Michael Heerdegen wrote:
> Eric Abrahamsen <address@hidden> writes:
>
>> - It is recursive (on car) instead of iterative.
>
> Yes, that's not good in your use case.
>
>> - It destructively replaces elements based on an alist lookup: if an
>>   element matches an alist key, it's replaced with the alist value.
>
> It also handles only lists - it can't traverse arrays, hash tables,
> structs, etc.  If you give that all up, however, `cl-sublis' is the
> canonical thing you get.

Well, if the alist value was allowed to be a callable, we could get all
that (not saying that's a good idea, I'm just saying it's awfully close).

> Note that "destructively" doesn't necessarily mean you can reuse the
> original structure (which is what you want).  In this case the
> implementation seems to guarantee that, however.

I thought that was exactly what "destructive" meant!?

Anyhoo, I think I've got a close enough handle on this to make the next
steps, thanks again for all your help.

Eric



reply via email to

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