Function: seq-split

seq-split is a byte-compiled function defined in seq-25.el.

Signature

(seq-split SEQUENCE LENGTH)

Documentation

Split SEQUENCE into a list of sub-sequences of at most LENGTH elements.

All the sub-sequences will be LENGTH long, except the last one, which may be shorter.

Source Code

;; Defined in ~/.emacs.d/elpa/seq-2.24/seq-25.el
(defun seq-split (sequence length)
  "Split SEQUENCE into a list of sub-sequences of at most LENGTH elements.
All the sub-sequences will be LENGTH long, except the last one,
which may be shorter."
  (when (< length 1)
    (error "Sub-sequence length must be larger than zero"))
  (let ((result nil)
        (seq-length (length sequence))
        (start 0))
    (while (< start seq-length)
      (push (seq-subseq sequence start
                        (setq start (min seq-length (+ start length))))
            result))
    (nreverse result)))