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: master d62766305a: Add `take` and `ntake` (bug#56521) Date: Mon, 18 Jul 2022 12:59:51 +0200 Message-ID: <2BF27629-33F1-42CF-95A5-3C2EBD4A0DD1@acm.org> References: <165807284522.13427.2673143161208860104@vcs2.savannah.gnu.org> <20220717154726.F2455C00095@vcs2.savannah.gnu.org> <87r12ierhi.fsf@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) 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="17845"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Robert Pluim Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jul 18 13:03:37 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 1oDOXI-0004PW-KO for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Jul 2022 13:03:36 +0200 Original-Received: from localhost ([::1]:36376 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oDOXH-0006mz-KS for ged-emacs-devel@m.gmane-mx.org; Mon, 18 Jul 2022 07:03:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDOTs-00052U-OA for emacs-devel@gnu.org; Mon, 18 Jul 2022 07:00:06 -0400 Original-Received: from mail208c50.megamailservers.eu ([91.136.10.218]:47296 helo=mail194c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oDOTp-0005ZM-9F for emacs-devel@gnu.org; Mon, 18 Jul 2022 07:00:04 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1658141994; bh=2f3Dpehhh7uuAT3Vn/0SCvurImMVFaIkG/DKUMk/2xU=; h=Subject:From:In-Reply-To:Date:Cc:References:To:From; b=A04HhLdLn8U8UYOQSRBg/Xlyr80rev/ig7cMfYYTGmCBgbpB8xVXukqDKjP1VBoL/ idmZIGejFHzK5w2NttLE+FAzlsBSxjtgvnUyy9lykck/xEgUX2rq/dgyVN0db1mnOl MNk+/z9bCjVd5Z17aY+5/klThfCm6OV/xqn8xvIk= Feedback-ID: mattiase@acm.or Original-Received: from smtpclient.apple (c188-150-171-71.bredband.tele2.se [188.150.171.71]) (authenticated bits=0) by mail194c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 26IAxqi0024928; Mon, 18 Jul 2022 10:59:54 +0000 In-Reply-To: <87r12ierhi.fsf@gmail.com> X-Mailer: Apple Mail (2.3654.120.0.1.13) X-CTCH-RefID: str=0001.0A782F28.62D53D2A.004E, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.10.218; envelope-from=mattiase@acm.org; helo=mail194c50.megamailservers.eu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665, 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:292233 Archived-At: 18 juli 2022 kl. 10.48 skrev Robert Pluim : > Does this need the usual blurb to do >=20 > (setq list-var (ntake 3 list-var)) >=20 > to ensure `list-var' is updated? Sort of; I added some text to that effect. Using the return value is = only needed if N can be nonpositive. > I think this would be clearer as >=20 > "If N is >=3D the length of LIST, return LIST (or a copy)." >=20 > since we=CA=BCre talking about the effect of various values of N. Right, it's now been changed to something like that. Thank you! Now `seq-take` uses `take`, and so does `seq-subseq`. This made both = faster, but the latter was boosted immensely by not formatting an error = string up-front. `seq-subseq` would be even faster if simply written as (take (- end start) (nthcdr start sequence)) but the interface requirements force a much more cumbersome = implementation. (And does it really need `copy-sequence`? The docs are = unclear.) I suppose that `seq-subseq` should use `cl-defmethod` for dispatching on = type but I didn't change that part.