Elisp: Sequence Functions
The Sequence library seq.el
seq.el is a library of functions on Sequence Type .
seq.el is new in Emacs 25 (date 2016)
seq.el is loaded when emacs starts. (no reed require)
Most of the functions provide new functionalities, some gives a unified interface to old functions e.g.
length,
mapcar,
mapc,
elt
.
Is Sequence
seqp→ return true if it's a sequence.
Length
seq-length→ number of items.seq-empty-p→ check is empty.
Copy Sequence
copy-sequence-
make a shallow copy. (if a element is a list, vector, record, they are not copied, but share reference with the original )
;; demo seq-copy is shallow copy (setq xx [3 4 [5 6]]) (setq xnew (seq-copy xx )) ;; [3 4 [5 6]] ;; set 9 to the element 5 in xnew (aset (aref xnew 2) 0 9) ;; 9 xnew ;; [3 4 [9 6]] ;; original is also changed xx [3 4 [9 6]]