emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] seq.el: add seq-last for symmetry with seq-first


From: Augusto Stoffel
Subject: Re: [PATCH] seq.el: add seq-last for symmetry with seq-first
Date: Tue, 14 Mar 2023 19:35:36 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Maybe it's more useful to allow negative arguments in seq-elt?  Saying
(seq-elt seq -1) isn't much more effort than (seq-last seq).

On Tue, 14 Mar 2023 at 16:14, Philip Kaludercic wrote:

>> I think for lists it should behave as `nth` or `elt`, so it gives nil.
>
> But why?  Wouldn't that be a leaky abstraction, since the behaviour
> doesn't consistently abstract over the concrete sequence types?  If code
> doesn't want to worry about what sequence is being used, then it has to
> manually check the return value or if a signal was raised, depending on
> the type of the argument to seq-last (which is to ignore the issue that
> we cannot distinguish between (seq-first '()) and (seq-first '(nil)),
> the same also being the case for seq-last).

It would be good to look systematically at what errors seq.el can
signal.  But it also seems that in practice the main value of seq.el is
to provide a bunch of handy functions rather than allowing you to work
with a sequence whose type you don't know.



reply via email to

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