Elisp: Sequence Join, Convert
Convert to Vector, Join Vectors
vconcat
-
(vconcat sequence1 sequence2 etc)
Join any Sequence Type and return a vector.
If a sequence is a string, each character is converted into a integer of its Codepoint
;; join vectors (vconcat [3 4] ["a" "b"]) ;; [3 4 "a" "b"] ;; join vector and list (vconcat [3 4] '("a" "b")) ;; [3 4 "a" "b"]
;; If a sequence is a string, each character is converted into a integer of its Codepoint (vconcat "abc") ;; [97 98 99]
Convert to List, Join Lists
append
-
(append sequence1 sequence2 etc)
Join any Sequence Type and return a list.
🛑 WARNING: if you want result to be Proper List , the last element must be a list, or nil.
;; join lists (append (list 1 2) (list 3 4)) ;; (1 2 3 4)
;; convert vector to list (append [1 2 3] nil) ;; (1 2 3) ;; this creates improper list (append [1 2 3] [4 5]) ;; (1 2 3 . [4 5]) ;; this creates proper list (append [1 2 3] [4 5] nil) ;; (1 2 3 4 5) ;; join vectors and lists to list (append [1 2 3] [4 5] '(6)) ;; (1 2 3 4 5 6) ;; proper list
;; If a sequence is a string, each character is converted into a integer of its Codepoint (append "abc" nil) ;; (97 98 99)
Sequence to String
Join Sequences, to List or Vector
seq-concatenate
-
(seq-concatenate TYPE SEQUENCE...)
join sequences, into a list or vector.
(this is a generalized version of
vconcat
andappend
);; to list (seq-concatenate 'list (list 1 2 3) (vector 4 5 6)) ;; (1 2 3 4 5 6) ;; to vector (seq-concatenate 'vector (list 1 2 3) (vector 4 5 6)) ;; [1 2 3 4 5 6] ;; to string (seq-concatenate 'string (list 97 98) (vector 99 100)) ;; "abcd" ;; integer is considered as char id ;; 97 is char a
Convert a Sequence to List or Vector
seq-into
-
(seq-into SEQUENCE TYPE)
convert sequence to a specific TYPE.
TYPE is one of:
'vector
'list
'string
(this is a generalized version of
vconcat
andappend
)(seq-into (list 3 4) 'vector) ;; [3 4] (seq-into (vector 3 4) 'list) ;; (3 4) (seq-into "abc" 'list) ;; (97 98 99) ;; string elements are converted to char. ;; 97 is the codepoint for the char a (seq-into "abc" 'vector) ;; [97 98 99] (seq-into (vector 97 98 99) 'string) ;; "abc"
;; nested item is not converted (seq-into (list 3 4 (list 3 4)) 'vector) ;; [3 4 (3 4)] (seq-into (vector 3 4 (vector 5 6)) 'list) ;; (3 4 [5 6])
Elisp, sequence functions
- Elisp: Sequence Type
- Elisp: Sequence Functions
- Elisp: Sequence, Take, Drop, Slice
- Elisp: Map to Sequence
- Elisp: Foreach (Side-Effect)
- Elisp: Sequence Iteration, Conditional Exit
- Elisp: Sequence Filter
- Elisp: Sequence Map Insert
- Elisp: Sequence Iteration
- Elisp: Sequence Find
- Elisp: Sequence, Sort, Reverse
- Elisp: Sequence Join, Convert
- Elisp: Sequence Union, Intersection, Difference
- Elisp: More Sequence Functions
- Elisp: Destructure Binding (seq-setq, seq-let)