GNU bug report logs - #27584
26.0.50; alist-get: Add optional arg TESTFN

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Wed, 5 Jul 2017 03:24:02 UTC

Severity: wishlist

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #110 received at 27584 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Nicolas Petton <nicolas <at> petton.fr>,
 Stefan Monnier <monnier <at> iro.umontreal.ca>, 27584 <at> debbugs.gnu.org
Subject: Re: bug#27584: 26.0.50; alist-get: Add optional arg TESTFN
Date: Mon, 10 Jul 2017 14:47:47 +0200
Tino Calancha <tino.calancha <at> gmail.com> writes:

> I rewrote it as follows:
>
>   (declare (compiler-macro
>             (lambda (form)
>               (pcase pred
>                 (''eq `(assq ,key ,alist))
>                 ((or ''equal 'nil) `(assoc ,key ,alist))
>                 ((and (guard (macroexp-const-p key)) ''eql)
>                  (if (floatp key)
>                      `(assoc ,key ,alist) `(assq ,key ,alist)))
>                 (t form)))))

Is this a good idea in general?  PRED could also be function-quoted, or
a variable bound to `eq'.  And KEY could be an expression that evaluates
to a float.  That would fail the `floatp' test.


Michael.




This bug report was last modified 7 years and 352 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.