emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: master d62766305a: Add `take` and `ntake` (bug#56521)


From: Sam Steingold
Subject: Re: master d62766305a: Add `take` and `ntake` (bug#56521)
Date: Mon, 18 Jul 2022 18:57:04 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (darwin)

> * Philip Kaludercic <cuvyvcx@cbfgrb.arg> [2022-07-18 18:56:24 +0000]:
>
> Sam Steingold <sds@gnu.org> writes:
>
>>> * Mattias Engdegård <znggvnfr@npz.bet> [2022-07-17 11:47:25 -0400]:
>>>
>>> branch: master
>>> commit d62766305ad8fe6ca1695341c34b9836d051e3cb
>>> Author: Mattias Engdegård <mattiase@acm.org>
>>> Commit: Mattias Engdegård <mattiase@acm.org>
>>>
>>>     Add `take` and `ntake` (bug#56521)
>>>     
>>>     These are useful list primitives, complementary to `nthcdr`.
>>
>> How are these better than the venerable butlast and nbutlast?
>> https://www.gnu.org/software/emacs/manual/html_node/elisp/List-Elements.html#index-butlast
>> note that butlast and nbutlast have a very long Lisp history, they
>> appear also in Common Lisp and many lisps before that.
>
> The immediate advantage I recognise is that you don't need to determine
> the length of the list if you are actually just interested in the first
> n, not just not-interested in the last m.

good point, thank you!

in that case you might consider modifying (n)butlast to
call (n)take to make them faster.



-- 
Sam Steingold (http://sds.podval.org/) on darwin Ns 10.3.2113
http://childpsy.net http://calmchildstories.com http://steingoldpsychology.com
https://www.memritv.org https://fairforall.org https://ffii.org
Incorrect time synchronization.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]