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: Lars Ingebrigtsen
Subject: bug#58278: Add new function seq-keep
Date: Tue, 04 Oct 2022 15:56:08 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Just for kicks, here's some random "del.*map" instances from the
Emacs sources:

(delq nil (mapcar (lambda (n) (and (>= n 0) n)) articles))

This should be (seq-filter #'cl-plusp articles).

(delq nil (mapcar #'gnus-server-to-method gnus-agent-covered-methods))

This would be nice as seq-keep.

      (delq nil (mapcar
                 (lambda (c)
                   (when (string-prefix-p base c)
                     (substring c base-size)))
                 hist)))))

Ditto.

   (delq nil (mapcar (lambda (action)
                       (cond
                        ((eq action 'create) 'created)
                        ((eq action 'modify) 'changed)
                        ((eq action 'attrib) 'attribute-changed)
                        ((memq action '(delete delete-self move-self)) 'deleted)
                        ((eq action 'moved-from) 'renamed-from)
                        ((eq action 'moved-to) 'renamed-to)
                        ((eq action 'ignored) 'stopped)))
                     actions))

Ditto.

     (delq nil (mapcar
                (lambda (x) (if (string-match "\\`\\." x) x))
                ido-temp-list)))

This should be seq-filter.

                        (cookies (delq nil (mapcar
                                            (lambda (e)
                                              (org-list-get-checkbox e s))
                                            items))))

seq-keep.

    (let* ((have (delq nil (mapcar
                            (lambda (x) (get-text-property 1 'time-of-day x))
                            list)))

seq-keep.

          (string-join
           (delq nil (mapcar
                      (lambda (item)
                        (when (cdr item)
                          (format "%s='%s'" (car item) (cdr item))))
                      `(("type" . ,type) ("sender" . ,sender)
                        ("destination" . ,destination) ("path" . ,path)
                        ("interface" . ,interface) ("member" . ,member))))
           ",")

seq-keep.

       (reverse (delete "" (mapcar (lambda (r)
                                     (replace-regexp-in-string "nil" "" r))
                                   result0)))))))

This suggest that the signature should be

(func sequence &optional delete-element)

which defaults to nil, but could be "" here, and use seq-keep.

  (delq 'type (mapcar #'car (haiku-selection-data clipboard nil))))

Ditto.







reply via email to

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