Function: ntake

ntake is a byte-compiled function defined in compat-29.el.

Signature

(ntake N LIST)

Documentation

[Compatibility function for ntake, defined in Emacs 29.1. See (compat) Emacs
29.1' for more details.]

Modify LIST to keep only the first N elements. If N is zero or negative, return nil. If N is greater or equal to the length of LIST, return LIST unmodified. Otherwise, return LIST after truncating it.

Source Code

;; Defined in ~/.emacs.d/elpa/compat-30.1.0.1/compat-29.el
;;;; Defined in fns.c

(compat-defun ntake (n list) ;; <compat-tests:ntake>
  "Modify LIST to keep only the first N elements.
If N is zero or negative, return nil.
If N is greater or equal to the length of LIST, return LIST unmodified.
Otherwise, return LIST after truncating it."
  (and (> n 0) (let ((cons (nthcdr (1- n) list)))
                 (when cons (setcdr cons nil))
                 list)))