From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Sam Steingold Newsgroups: gmane.emacs.devel Subject: Re: master d62766305a: Add `take` and `ntake` (bug#56521) Date: Mon, 18 Jul 2022 18:57:04 -0400 Message-ID: References: <165807284522.13427.2673143161208860104@vcs2.savannah.gnu.org> <20220717154726.F2455C00095@vcs2.savannah.gnu.org> <87cze21c87.fsf@posteo.net> Reply-To: sds@gnu.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31687"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin) To: emacs-devel@gnu.org, Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Jul 19 00:58:17 2022 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 1oDZgv-00081b-5x for ged-emacs-devel@m.gmane-mx.org; Tue, 19 Jul 2022 00:58:17 +0200 Original-Received: from localhost ([::1]:34758 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDZgt-0007Gt-Ih for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Jul 2022 18:58:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41050) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDZfp-0006PM-RY for emacs-devel@gnu.org; Mon, 18 Jul 2022 18:57:09 -0400 Original-Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:46874) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oDZfn-0004g0-QP; Mon, 18 Jul 2022 18:57:09 -0400 Original-Received: by mail-qk1-x72f.google.com with SMTP id v28so8411044qkg.13; Mon, 18 Jul 2022 15:57:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:subject:in-reply-to:references:user-agent :return-receipt-to:reply-to:mail-followup-to:date:message-id :mime-version:content-transfer-encoding; bh=cxY9wtVPP3B39ym0tLb0aj/mDeQsvsXXggtzSF4ZS/c=; b=MvG2dig4ziWUugZil+YkDQ31l9AQdsqjaG0GNrvQ923/C5U1fDswZVHiUn8PZmngtT rgckAwbNRqLJypRqhOsJi7g/jyg6ZD6a4G6EfnDsONkpdJUJt6TUCvTjneWTK+fx7Y/J acmGZ5cuBaoyLkZULPWzReXylcJOqrElDqykyxoaWYt0MxhFpbG+um9C83K3VINt4cdj xivDkYwDr9j508IoonOpnpaknCPt4weLcXr1e01Sk6bZl94mToscJ9C/C9H3sXz8FGRC ESZg7+67aJsBV7/Na+z9oI2jcQjURQ6BMdbu/aJKZoJQJZUOiOkQoeUwxm2afk8AYZC0 k2jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:subject:in-reply-to:references :user-agent:return-receipt-to:reply-to:mail-followup-to:date :message-id:mime-version:content-transfer-encoding; bh=cxY9wtVPP3B39ym0tLb0aj/mDeQsvsXXggtzSF4ZS/c=; b=dgsIlV+pwjvZKIZ9yqMHHqVZ2EfIKmmu+nwFy4m7b7Ouo4i3HoLQcX023MI6BNmeQI iCgM7iOn0MNHuwipoXz9YN7mvYGzM9rlJz22VGxuEsv7E+S3gTvXDpHitLuaBCtQyFZX aoe2knhmDBxmcX3dLA0zZ5DW0kw6M7n3dQ/5VdyTMJPyBb2+BRfqGF7dLPziAnUeKeM7 nthp5ObhlOpaQsht6P262HsJwlO2+S54OKmRAfwnLR+BMu4UR0upUk/T+xbVJGShfk7N 8STuHvhcIoBo9HRoLh63NyQxJe/GBvZcULr4wFe+1JZHoWCRpoA9ZUJh6TmbRdwn0IFg IsQA== X-Gm-Message-State: AJIora/tlYlYiL8FT0hdB8eoonp9XV371HwDUBOPm50BKRKxkAPvR8Ou wBMGl3i8iCKnOG2/BY/8SEvkdcK4Bw== X-Google-Smtp-Source: AGRyM1sSwjZRatVkwoxysjAUpV8p2O2/rODIjaNExEGk88N4W/UJcp/FLM3diPzqtipC8eDQk7W0iw== X-Received: by 2002:ae9:f10a:0:b0:6b5:c5bd:3748 with SMTP id k10-20020ae9f10a000000b006b5c5bd3748mr13483100qkg.443.1658185026238; Mon, 18 Jul 2022 15:57:06 -0700 (PDT) Original-Received: from 3c22fb11fdab.ant.amazon.com (pool-108-30-23-113.nycmny.fios.verizon.net. [108.30.23.113]) by smtp.gmail.com with ESMTPSA id bv20-20020a05622a0a1400b0031eb5342520sm3697062qtb.15.2022.07.18.15.57.05 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jul 2022 15:57:05 -0700 (PDT) In-Reply-To: <87cze21c87.fsf@posteo.net> (Philip Kaludercic's message of "Mon, 18 Jul 2022 18:56:24 +0000") X-Attribution: Sam X-Disclaimer: You should not expect anyone to agree with me. Mail-Followup-To: emacs-devel@gnu.org, Philip Kaludercic Received-SPF: pass client-ip=2607:f8b0:4864:20::72f; envelope-from=sam.steingold@gmail.com; helo=mail-qk1-x72f.google.com X-Spam_score_int: -14 X-Spam_score: -1.5 X-Spam_bar: - X-Spam_report: (-1.5 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no 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" Xref: news.gmane.io gmane.emacs.devel:292248 Archived-At: > * Philip Kaludercic [2022-07-18 18:56:24 +0000]: > > Sam Steingold writes: > >>> * Mattias Engdeg=C3=83=C2=A5rd [2022-07-17 11:47:25 = -0400]: >>> >>> branch: master >>> commit d62766305ad8fe6ca1695341c34b9836d051e3cb >>> Author: Mattias Engdeg=C3=A5rd >>> Commit: Mattias Engdeg=C3=A5rd >>> >>> Add `take` and `ntake` (bug#56521) >>>=20=20=20=20=20 >>> These are useful list primitives, complementary to `nthcdr`. >> >> How are these better than the venerable butlast and nbutlast? >> https://www.gnu.org/software/emacs/manual/html_node/elisp/List-Elements.= html#index-butlast >> note that butlast and nbutlast have a very long Lisp history, they >> appear also in Common Lisp and many lisps before that. > > The immediate advantage I recognise is that you don't need to determine > the length of the list if you are actually just interested in the first > n, not just not-interested in the last m. good point, thank you! in that case you might consider modifying (n)butlast to call (n)take to make them faster. --=20 Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113 http://childpsy.net http://calmchildstories.com http://steingoldpsychology.= com https://www.memritv.org https://fairforall.org https://ffii.org Incorrect time synchronization.