From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Eric Abrahamsen Newsgroups: gmane.emacs.bugs Subject: bug#34708: alist-get has unclear documentation Date: Mon, 04 Mar 2019 08:24:14 -0800 Message-ID: <875zsyhakx.fsf@ericabrahamsen.net> References: <87wolhr5k6.fsf@web.de> <87y35xdu4w.fsf@web.de> <87mumcdu7f.fsf@web.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="93237"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: Michael Heerdegen , "Miguel V. S. Frasson" , 34708@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 04 17:32:13 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h0qVg-000O5z-Py for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Mar 2019 17:32:13 +0100 Original-Received: from localhost ([127.0.0.1]:56860 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0qVf-0002aJ-Kb for geb-bug-gnu-emacs@m.gmane.org; Mon, 04 Mar 2019 11:32:11 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:45916) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h0qOl-0005fg-Bm for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2019 11:25:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h0qOk-0002Yo-M7 for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2019 11:25:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h0qOk-0002YW-9O for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2019 11:25:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1h0qOj-0008AH-Oo for bug-gnu-emacs@gnu.org; Mon, 04 Mar 2019 11:25:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eric Abrahamsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 04 Mar 2019 16:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 34708 X-GNU-PR-Package: emacs Original-Received: via spool by 34708-submit@debbugs.gnu.org id=B34708.155171666831336 (code B ref 34708); Mon, 04 Mar 2019 16:25:01 +0000 Original-Received: (at 34708) by debbugs.gnu.org; 4 Mar 2019 16:24:28 +0000 Original-Received: from localhost ([127.0.0.1]:60113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h0qOC-00089M-5J for submit@debbugs.gnu.org; Mon, 04 Mar 2019 11:24:28 -0500 Original-Received: from ericabrahamsen.net ([52.70.2.18]:37064 helo=mail.ericabrahamsen.net) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1h0qO6-000891-Cs for 34708@debbugs.gnu.org; Mon, 04 Mar 2019 11:24:24 -0500 Original-Received: from localhost (97-126-72-117.tukw.qwest.net [97.126.72.117]) (Authenticated sender: eric@ericabrahamsen.net) by mail.ericabrahamsen.net (Postfix) with ESMTPSA id 3EB5BFA035; Mon, 4 Mar 2019 16:24:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ericabrahamsen.net; s=mail; t=1551716656; bh=KYURVqEIuv8THbPqSfdCU/sJc3pwxIJfjZRfyvzvVpA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=JXb2eBncVHVBaiaf0f6xIkdgyGj99gHurYIVAm1A1fj4M+n42et6jRLBUs+ZmWF6U NBTZQa25hveAzeXadZXLGPQDR/B/IqH6CYd5gUpTWA3/ZUuX81kVpyF+EMKsbo1oeg Z4LsLZ7xEG+K2oxTfGni9NH3mzJcGAFigZ7CUa8Y= In-Reply-To: (Drew Adams's message of "Sun, 3 Mar 2019 07:51:51 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:156031 Archived-At: On 03/03/19 07:51 AM, Drew Adams wrote: [...] > It's important to not give the impression that > there must be an _existing_ element with KEY. > Showing an example can help dispel that mistake. > > (setq foo ()) > (setf (alist-get 'a foo) 1 > (alist-get 'b foo) 2) > > C-h v foo; ==> ((b. 2) (a. 1)) I think it would be nice to have an example that shows both a common use-case (as an accumulator), and how to use REMOVE. I started off with the accumulator part: (let (word word-freq) (while (setq word (pop word-list)) (cl-incf (alist-get word word-freq 0 #'equal) 1))) But so far haven't come up with a non-contrived way to work REMOVE in there...