From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.devel Subject: Re: Help with recursive destructive function Date: Wed, 06 Jun 2018 17:49:43 -0700 Message-ID: <87in6v2zfc.fsf@ericabrahamsen.net> References: <87efiqzzd2.fsf@ericabrahamsen.net> <87zi1e9kju.fsf@web.de> <87o9hs3aht.fsf@ericabrahamsen.net> <87bmds9qcg.fsf@web.de> <87k1sg185t.fsf@ericabrahamsen.net> <044bdbf1-39a2-0e71-ec79-3d375d9109c8@gmail.com> <877eof1k7y.fsf@ericabrahamsen.net> <87wowe2sql.fsf@web.de> <877eoe2dma.fsf@ericabrahamsen.net> <87tvrgqnug.fsf@web.de> <87vabvbfrj.fsf@web.de> <87d0y30wkn.fsf@ericabrahamsen.net> <878t8mtiqz.fsf@web.de> <87vaayp4p8.fsf@ericabrahamsen.net> <87in6yw06e.fsf@web.de> <87wovbvd6y.fsf@ericabrahamsen.net> <877enba86p.fsf@web.de> <87vaavtvl5.fsf@ericabrahamsen.net> <87a7s7tst7.fsf@ericabrahamsen.net> <87lgbr8pdn.fsf@web.de> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1528332690 14984 195.159.176.226 (7 Jun 2018 00:51:30 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 7 Jun 2018 00:51:30 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Jun 07 02:51:26 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1fQj9C-0003ma-9l for ged-emacs-devel@m.gmane.org; Thu, 07 Jun 2018 02:51:26 +0200 Original-Received: from localhost ([::1]:55204 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQjBJ-0000T6-EC for ged-emacs-devel@m.gmane.org; Wed, 06 Jun 2018 20:53:37 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fQjAa-0000Sz-CY for emacs-devel@gnu.org; Wed, 06 Jun 2018 20:52:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fQjAV-0001Wg-FJ for emacs-devel@gnu.org; Wed, 06 Jun 2018 20:52:52 -0400 Original-Received: from mail.ericabrahamsen.net ([50.56.99.223]:54242) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fQjAV-0001T3-9x for emacs-devel@gnu.org; Wed, 06 Jun 2018 20:52:47 -0400 Original-Received: from localhost (97-113-228-224.tukw.qwest.net [97.113.228.224]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 6C690C1D03; Thu, 7 Jun 2018 00:52:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mail.ericabrahamsen.net; s=mail; t=1528332757; bh=KPRLHGY1vy8pvnaaaWtZ1NXBIi8fGeYxvJlnWFBRO+o=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=X76uqgLguNlLmOnHukKPr0OnjUwag/G+9PWljiO1xFH54V4j3NZ0ZzVt6n8TDiL0d XvW72YAY5AEDnYpgR7c/dSA30mwDA1zsFZhyL+4EBBLqAr7cQ5662mJsQGk+IsYqAM VwqSa5coektXTg1/LTACFf3ptnSlfiVgGBB8TEcI= In-Reply-To: <87lgbr8pdn.fsf@web.de> (Michael Heerdegen's message of "Thu, 07 Jun 2018 01:30:12 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 50.56.99.223 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:226087 Archived-At: On 06/07/18 01:30 AM, Michael Heerdegen wrote: > Eric Abrahamsen 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