all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Generic sequences in seq.el
@ 2018-12-21 11:42 Yuan Fu
  2018-12-21 14:24 ` Stefan Monnier
  0 siblings, 1 reply; 6+ messages in thread
From: Yuan Fu @ 2018-12-21 11:42 UTC (permalink / raw)
  To: emacs-devel

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-01-08 15:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-21 11:42 Generic sequences in seq.el Yuan Fu
2018-12-21 14:24 ` 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

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.