bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#59328: 29.0.50; `seq-keep' implementation only valid for lists


From: Michael Heerdegen
Subject: bug#59328: 29.0.50; `seq-keep' implementation only valid for lists
Date: Thu, 24 Nov 2022 16:25:44 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Eli Zaretskii <eliz@gnu.org> writes:

> > Without that change `seq-keep' would error for sequence types like
> > streams.  Try for example
> >
> > #+begin_src emacs-lisp
> > (require 'stream)
> > (seq-keep
> >  (lambda (x) (and (<= 0 x) x))
> >  (stream (list -1 2 -3 4)))
> > #+end_src
>
> Didn't you just say that 'stream' is not in Emacs?  If I try the above, the
> debugger kicks in right on the 'require' line.

Yes.

But seq-keep is not a generic function, so it would be broken for
sequence types defined elsewhere, and there is no way for those other
sequence types to fix this.  Defining a generic interface for sequences
would not make much sense if it then only supports lists (and maybe
vectors).

So we want to support cases like streams.  Since seq-keep can be
expressed and is semantically equivalent a simple concetanation of
existing sequence operations there is probably no need to define it as
generic function.  We just need to implement it correctly to support any
otherwise supported type of sequences.

Michael.





reply via email to

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