unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: "Mattias Engdegård" <mattiase@acm.org>,
	"48261@debbugs.gnu.org" <48261@debbugs.gnu.org>,
	Philipp <p.stephani2@gmail.com>
Subject: bug#48261: [External] : bug#48261: 28.0.50; Optimize `eql' to `eq' for fixnums
Date: Fri, 7 May 2021 15:24:59 +0000	[thread overview]
Message-ID: <SA2PR10MB447471229833CD847AB02B02F3579@SA2PR10MB4474.namprd10.prod.outlook.com> (raw)
In-Reply-To: <1611E274-F759-4BBE-B136-FB6CDFD557B5@acm.org>

> (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	other threads:[~2021-05-07 15:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06 17:20 bug#48261: 28.0.50; Optimize `eql' to `eq' for fixnums Philipp Stephani
2021-05-07  9:23 ` Mattias Engdegård
2021-05-07 15:24   ` Drew Adams [this message]
2021-05-08  9:17   ` Philipp
2021-05-08 13:26     ` Mattias Engdegård
2021-05-16 12:48       ` Philipp Stephani

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=SA2PR10MB447471229833CD847AB02B02F3579@SA2PR10MB4474.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=48261@debbugs.gnu.org \
    --cc=mattiase@acm.org \
    --cc=p.stephani2@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).