Subject: Re: bug#58278: Add new function seq-keep

From: Robert Pluim <[email-masked]>
Date: Tue, 04 Oct 2022 13:21:06 +0200

>>>>> On Tue, 04 Oct 2022 13:10:38 +0200, Lars Ingebrigtsen <[email-masked]> said:

    Lars> Robert Pluim <[email-masked]> writes:
    >> Thatʼs why I said "apart from the syntactic sugar" 😀

    Lars> Having to rewrite

    Lars> (seq-keep #'cl-digit-char-p '(?6 ?a))
    Lars> => (6)

    Lars> to

    Lars> (cl-mapcan (lambda (c)
    Lars> 	     (let ((res (cl-digit-char-p c)))
    Lars> 	       (and res (list res))))
    Lars> 	   '(?6 ?a))
    Lars> => (6)

    Lars> is more than "syntactic sugar" in my book.  Nobody would want to write
    Lars> code like the latter.

I never meant that. I meant defining `seq-keep' in terms of `'cl-mapcan',
with the appropriate converting elements to lists done for you (or
even using `mapcan' if youʼre willing to give up the &rest behaviour
of `cl-mapcan')

Robert
--