Elisp: More Sequence Functions
Restructure, Reshape
seq-partition
-
(seq-partition (number-sequence 1 7 ) 2) ;; ((1 2) (3 4) (5 6) (7))
seq-split
-
note:
seq-split
andseq-partition
seems to be mostly identical.(seq-split (number-sequence 1 7) 2) ;; ((1 2) (3 4) (5 6) (7))
seq-group-by
-
(seq-group-by FUNCTION SEQUENCE)
- Group items into a Association List .
- The return value of FUNCTION is used as the key.
(setq xx (seq-group-by (lambda (x) (cond ((equal (mod x 2) 0) "2") ((equal (mod x 3) 0) "3") ((equal (mod x 5) 0) "5") (t "other"))) (number-sequence 1 30))) ;; ( ;; ("5" 5 25) ;; ("3" 3 9 15 21 27) ;; ("other" 1 7 11 13 17 19 23 29) ;; ("2" 2 4 6 8 10 12 14 16 18 20 22 ...) ;; ) (assoc "3" xx) ;; ("3" 3 9 15 21 27)
misc
seq-random-elt
-
(seq-random-elt SEQUENCE)
Return a randomly element.
(seq-random-elt [3 4 5])
Min, Max
seq-min
- get the smallest number.
seq-max
- Get the biggest number.
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)