From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.devel Subject: Re: Negative nth index Date: Wed, 25 Dec 2024 13:14:05 +0100 Message-ID: <5D930F52-CD28-4E5E-89B2-1E9DC3945011@gmail.com> References: <865xnc6u9n.fsf@gnu.org> <87jzbs9jlk.fsf@gnu.org> <87r05wahsi.fsf@protonmail.com> <350E9109-04F6-4C20-B0F6-37C0A482DAD3@gmail.com> <87ed1w9glz.fsf@protonmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26068"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Monnier , Stefan Kangas , Tassilo Horn , Eli Zaretskii , Anand Tamariya , emacs-devel@gnu.org To: Pip Cet Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 25 13:14:55 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tQQHv-0006bV-SV for ged-emacs-devel@m.gmane-mx.org; Wed, 25 Dec 2024 13:14:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tQQHJ-000492-12; Wed, 25 Dec 2024 07:14:17 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tQQHF-00048i-87 for emacs-devel@gnu.org; Wed, 25 Dec 2024 07:14:13 -0500 Original-Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tQQHD-0006h8-P0; Wed, 25 Dec 2024 07:14:13 -0500 Original-Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-3022598e213so62453381fa.0; Wed, 25 Dec 2024 04:14:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735128848; x=1735733648; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=jjCMdWCtdFEpEf62Y8staqXeXqydsuR9TdBbbsF/GbA=; b=E+zsxUzfSSoZr7Q2Itg8ssElApzA+tn++Fbirc1J+EAPjSOdMrpQMvfJxcAJ7rxNwc zaE6BvEciC9iprY0hgW1R834PJc+Ux6pJeV/0sPCTS2DBcz1BUUuWNr/q01hc8mnXyXr fcpnGB04iRWfW16MJV2OOlSGkhg6S9ZhCWdUwwzEBVzS1af0R3IdAZwLEOKPnKWhEgeC Z0JxrTSiiI9RV6sxQlnqDMMX+O2kkflfr7TF3hjg+F5hWj4N5iLlRZBJLskztJm9af4r OOSwkg4FiRm77P0kJu0e84C6inmYVOnCo37omc194MtXkLaLig0qQeWKW+dMosJNrZW+ o5Ww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735128848; x=1735733648; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jjCMdWCtdFEpEf62Y8staqXeXqydsuR9TdBbbsF/GbA=; b=pg41OqzBqteSk1ESIDVZm1kET13qrP9jDoZ5q6cEj/MJrT5jhY/v/lccVqpWUg39yR UyitEDoLwP1NGCAoFCyn8DcdAfP96fys2T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bsLeJTEmAzkyS4g== X-Received: by 2002:a05:651c:b21:b0:302:251a:bd21 with SMTP id 38308e7fff4ca-30468546425mr56706631fa.15.1735128847338; Wed, 25 Dec 2024 04:14:07 -0800 (PST) Original-Received: from smtpclient.apple (c188-150-183-180.bredband.tele2.se. [188.150.183.180]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-3045ad6c504sm20147551fa.10.2024.12.25.04.14.06 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Dec 2024 04:14:06 -0800 (PST) In-Reply-To: <87ed1w9glz.fsf@protonmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.15) Received-SPF: pass client-ip=2a00:1450:4864:20::231; envelope-from=mattias.engdegard@gmail.com; helo=mail-lj1-x231.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327077 Archived-At: 25 dec. 2024 kl. 11.56 skrev Pip Cet : > s/nth/nthcdr/g in my email, then. Of course the two should behave > analogously, the question is whether they should both throw an error = (my > opinion) or shouldn't. The behaviour of nthcdr for negative N is well-established and turns out = to be somewhat useful in practice. If compatibility with existing code were completely unimportant, I'd = recommend that negative arguments cause nth to signal but not nthcdr. = But it isn't, so I don't. > If it were merely undocumented, I might agree, but the current = behavior > doesn't match the documentation, Yes, the manual and doc strings could certainly be improved. > because taking cdr -1 times is > obviously an impossible thing to do. Well now, we could define (nthcdr N L) =3D (cons nil (nthcdr (1+ N) L) for N<0. (No, we shouldn't.) > This isn't about performance. Of course it's about performance. In some respect it always is!