unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "John Wiegley" <johnw@gnu.org>
To: jun <netjune@163.com>
Cc: "Elias Mårtenson" <lokedhs@gmail.com>, emacs-devel <emacs-devel@gnu.org>
Subject: Re: Can we add two args to copy-sequence?
Date: Fri, 15 Dec 2017 22:18:38 -0800	[thread overview]
Message-ID: <m2tvwrtcu9.fsf@newartisans.com> (raw)
In-Reply-To: <41cc6ca4.f2de.1605aa9400f.Coremail.netjune@163.com> (jun's message of "Fri, 15 Dec 2017 22:52:09 +0800 (CST)")

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

>>>>> "j" == jun <netjune@163.com> writes:

j> Yes, I just know subseq. And there are also seq-subseq, seq-take, seq-drop,
j> butlast, Two many and hard to remmber. Almost all of them are implemented
j> in lisp except copy-sequence which is in C. Some of them are implemented by
j> copying the whole sequence and then modify the copy. If we add the two args
j> to copy-sequence, then these functions can be based on it with only one or
j> two lines in lisp, and reduce some data copy. Does the two args make
j> copy-sequence too much complex internally?

Ah, subseq, there it is. I kept looking for sublist or some variant thereof.

It's not that it's too complex internally, it's that extracting a sublist is
not the purpose of copy-sequence. You are asking us to add extra arguments to
a function to double its purpose, in a way that's more than just "copying a
sequence", as the name implies.

I'm very much against shoe-horning other behaviors into functions that appear
"close enough" for this sort of convenience. Please use cl-subseq. If we need
to move subseq into C, that's a different request, and could be made on
grounds of efficiency or speed. But I won't make copy-sequence more complex
for this reason.

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 658 bytes --]

      reply	other threads:[~2017-12-16  6:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15  3:32 Can we add two args to copy-sequence? jun
2017-12-15  7:54 ` John Wiegley
2017-12-15  8:24   ` Elias Mårtenson
2017-12-15 14:52     ` jun
2017-12-16  6:18       ` John Wiegley [this message]

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=m2tvwrtcu9.fsf@newartisans.com \
    --to=johnw@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lokedhs@gmail.com \
    --cc=netjune@163.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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).