From: Yuan Fu <casouri@gmail.com>
To: emacs-devel@gnu.org
Subject: Generic sequences in seq.el
Date: Fri, 21 Dec 2018 06:42:20 -0500 [thread overview]
Message-ID: <CAO0xp5zdpiT_B5r2LEu4UpgYRO9SfKm+wcL3vBXqFCA8Sn2btg@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 784 bytes --]
I'm trying to "upgrade" some methods from supporting list to supporting
generic sequence.
However, I couldn't figure out how to change the value of a sequence
destructively.
E.g., if I want to insert a element into a list, I can do something like
(setf (nthcdr n seq) (cons element (nthcdr n seq)))
to insert element into the nth position in seq
But with sequences, I don't see any generic functions that can do similar
work.
Am I missing something?
BTW, what I'm doing now is define my own generic function, like
(cl-defgeneric my-insert-at (elt seq)))
The idea is I'll implement this function for the generic sequence
that I'll define in the future. Is that a correct approach?
Other destructive functions that I couldn't find alternatives are delete,
push, pop, etc.
[-- Attachment #2: Type: text/html, Size: 2165 bytes --]
next reply other threads:[~2018-12-21 11:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 11:42 Yuan Fu [this message]
2018-12-21 14:24 ` Generic sequences in seq.el Stefan Monnier
2018-12-23 2:04 ` Yuan Fu
2018-12-23 14:34 ` Stefan Monnier
2019-01-08 4:12 ` Yuan Fu
2019-01-08 15:01 ` Stefan Monnier
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=CAO0xp5zdpiT_B5r2LEu4UpgYRO9SfKm+wcL3vBXqFCA8Sn2btg@mail.gmail.com \
--to=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
/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.