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 #65 received at 27584 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Tino Calancha <tino.calancha <at> gmail.com>
Cc: Nicolas Petton <nicolas <at> petton.fr>, 27584 <at> debbugs.gnu.org
Subject: Re: bug#27584: 26.0.50; alist-get: Add optional arg TESTFN
Date: Fri, 07 Jul 2017 11:53:58 -0400
> +  (declare (compiler-macro
> +            (lambda (_)
> +              `(pcase ,pred
> +                 ('eq (assq ,key ,alist))
> +                 ((or 'equal 'nil) (assoc ,key ,alist))
> +                 ((guard (and (macroexp-const-p ,key) (eq ,pred 'eql)))
> +                  (if (floatp ,key)
> +                      (assoc ,key ,alist) (assq ,key ,alist)))
> +                 (_ (assoc-default ,key ,alist ,pred nil 'full))))))

This replaces a call to the function with a chunk of code which does
`pcase`, which is not what we want: we want the `pcase` to be executed
during compilation and if we can't choose which branch to follow, then
we just keep the call unchanged (which is why, in my define-inline
example, the pcase was outside of `inline-quote`).


        Stefan




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

Previous Next


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