all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Robert Pluim <rpluim@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: master d62766305a: Add `take` and `ntake` (bug#56521)
Date: Mon, 18 Jul 2022 12:59:51 +0200	[thread overview]
Message-ID: <2BF27629-33F1-42CF-95A5-3C2EBD4A0DD1@acm.org> (raw)
In-Reply-To: <87r12ierhi.fsf@gmail.com>

18 juli 2022 kl. 10.48 skrev Robert Pluim <rpluim@gmail.com>:

> Does this need the usual blurb to do
> 
> (setq list-var (ntake 3 list-var))
> 
> 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
> 
> "If N is >= the length of LIST, return LIST (or a copy)."
> 
> since weʼre 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.




  reply	other threads:[~2022-07-18 10:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <165807284522.13427.2673143161208860104@vcs2.savannah.gnu.org>
     [not found] ` <20220717154726.F2455C00095@vcs2.savannah.gnu.org>
2022-07-18  8:48   ` master d62766305a: Add `take` and `ntake` (bug#56521) Robert Pluim
2022-07-18 10:59     ` Mattias Engdegård [this message]
2022-07-18 11:55       ` Robert Pluim
2022-07-18 16:34         ` Michael Heerdegen
2022-07-18 17:21   ` Sam Steingold
2022-07-18 18:56     ` Philip Kaludercic
2022-07-18 22:57       ` Sam Steingold
2022-07-19 10:20         ` Mattias Engdegård

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2BF27629-33F1-42CF-95A5-3C2EBD4A0DD1@acm.org \
    --to=mattiase@acm.org \
    --cc=emacs-devel@gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.