Function: -split-at

-split-at is a byte-compiled function defined in dash.el.

Signature

(-split-at N LIST)

Documentation

Split LIST into two sublists after the Nth element.

The result is a list of two elements (TAKE DROP) where TAKE is a new list of the first N elements of LIST, and DROP is the remaining elements of LIST (not a copy). TAKE and DROP are like the results of -take and -drop, respectively, but the split is done in a single list traversal.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -split-at (n list)
  "Split LIST into two sublists after the Nth element.
The result is a list of two elements (TAKE DROP) where TAKE is a
new list of the first N elements of LIST, and DROP is the
remaining elements of LIST (not a copy).  TAKE and DROP are like
the results of `-take' and `-drop', respectively, but the split
is done in a single list traversal."
  (declare (side-effect-free t))
  (let (result)
    (--each-while list (< it-index n)
      (push (pop list) result))
    (list (nreverse result) list)))