all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: 59328@debbugs.gnu.org
Cc: Lars Ingebrigtsen <larsi@gnus.org>, Jonas Bernoulli <jonas@bernoul.li>
Subject: bug#59328: 29.0.50; `seq-keep' implementation only valid for lists
Date: Thu, 17 Nov 2022 03:17:46 +0100	[thread overview]
Message-ID: <87wn7ujpdh.fsf@web.de> (raw)


Hello,

  [FWIW I tried to reopen 58278 but it seemed to...complicated for me]

The current implementation of the (non-generic!) function `seq-keep':

#+begin_src emacs-lisp
(defun seq-keep (function sequence)
  (delq nil (seq-map function sequence)))
;; ^^^^
#+end_src

obviously only works when `seq-map' returns a list.  This is the case
for the default implementation of the generic function `seq-map' but not
necessarily for other implementations of `seq-map'.

We need to filter out the `nil' elements with a way appropriate for any
sequence type supported by "seq.el" (i.e. with a generic function
defined in this lib), e.g.

#+begin_src emacs-lisp
(defun seq-keep (function sequence)
  (seq-filter #'identity (seq-map function sequence)))
#+end_src


BTW, is the name a good one?  Why "keep"?  It returns a sequence of
potentially all completely different elements.  And is the function that
useful and a good abstraction at all (I don't have thought about it
too long...)?


TIA,

Michael.







             reply	other threads:[~2022-11-17  2:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-17  2:17 Michael Heerdegen [this message]
2022-11-19 13:12 ` bug#59328: 29.0.50; `seq-keep' implementation only valid for lists Eli Zaretskii
2022-11-24 13:04   ` Michael Heerdegen
2022-11-24 14:19     ` Eli Zaretskii
2022-11-24 14:26       ` Michael Heerdegen
2022-11-24 15:00         ` Eli Zaretskii
2022-11-24 15:09           ` Michael Heerdegen
2022-11-24 15:15             ` Eli Zaretskii
2022-11-24 15:25               ` Michael Heerdegen
2022-11-24 17:02                 ` Eli Zaretskii
2022-11-25  9:47                   ` Michael Heerdegen
2022-11-25 11:34                     ` Stefan Kangas
2022-11-25 11:55                     ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wn7ujpdh.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=59328@debbugs.gnu.org \
    --cc=jonas@bernoul.li \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.