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

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

bug#48261: [External] : bug#48261: 28.0.50; Optimize `eql' to `eq' for f


From: Drew Adams
Subject: bug#48261: [External] : bug#48261: 28.0.50; Optimize `eql' to `eq' for fixnums
Date: Fri, 7 May 2021 15:24:59 +0000

> (We really should have fast, readable, always-available 
> standard functions or macros for 'some' and 'every' on lists.)

Does this qualify?

(defun some-elt-p (xs pred)
  "Return non-nil if (PRED X) is true for some element of list XS."
  (catch 'some-element-p
    (dolist (x  xs)
      (and (funcall pred x)  (throw 'some-element-p t)))))

(defun all-elts-p (xs pred)
  "Return non-nil if (PRED X) is true for all elements of list XS."
  (catch 'all-elts-p
    (dolist (x  xs  t)
      (or (funcall pred x)  (throw 'all-elts-p nil)))))

[I think I'd prefer the opposite arg order: PRED first,
 but this is at least the same as what CL uses.  Consider
 (apply-partially #'some-elt-p PRED), for instance.]





reply via email to

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