[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master d62766305a: Add `take` and `ntake` (bug#56521)
From: |
Robert Pluim |
Subject: |
Re: master d62766305a: Add `take` and `ntake` (bug#56521) |
Date: |
Mon, 18 Jul 2022 10:48:25 +0200 |
>>>>> On Sun, 17 Jul 2022 11:47:25 -0400 (EDT), Mattias Engdegård
>>>>> <mattiase@acm.org> said:
Mattias> +@defun ntake n list
Mattias> +This is a version of @code{take} that works by destructively
modifying
Mattias> +the list structure of the argument. That makes it faster, but the
Mattias> +original value of @var{list} is lost.
Mattias> +@end defun
Mattias> +
Mattias> @defun last list &optional n
Mattias> This function returns the last link of @var{list}. The
@code{car} of
Mattias> this link is the list's last element. If @var{list} is
Mattias> null,
Does this need the usual blurb to do
(setq list-var (ntake 3 list-var))
to ensure `list-var' is updated?
Mattias> +DEFUN ("take", Ftake, Stake, 2, 2, 0,
Mattias> + doc: /* Return the first N elements of LIST.
Mattias> +If N is zero or negative, return nil.
Mattias> +If LIST is no more than N elements long, return it (or a copy).
*/)
Mattias> + (Lisp_Object n, Lisp_Object list)
I think this would be clearer as
"If N is >= the length of LIST, return LIST (or a copy)."
since weʼre talking about the effect of various values of N.
Mattias> +
Mattias> +DEFUN ("ntake", Fntake, Sntake, 2, 2, 0,
Mattias> + doc: /* Modify LIST to keep only the first N elements.
Mattias> +If N is zero or negative, return nil.
Mattias> +If LIST is no more than N elements long, return it. */)
And similarly here.
Robert
--
- Re: master d62766305a: Add `take` and `ntake` (bug#56521),
Robert Pluim <=