emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Generic sequences in seq.el


From: Yuan Fu
Subject: Generic sequences in seq.el
Date: Fri, 21 Dec 2018 06:42:20 -0500

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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]