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

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

bug#58278: Add new function seq-keep


From: Robert Pluim
Subject: bug#58278: Add new function seq-keep
Date: Tue, 04 Oct 2022 13:21:06 +0200

>>>>> On Tue, 04 Oct 2022 13:10:38 +0200, Lars Ingebrigtsen <larsi@gnus.org> 
>>>>> said:

    Lars> Robert Pluim <rpluim@gmail.com> 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
-- 





reply via email to

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