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

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

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


From: Stefan Monnier
Subject: bug#27584: 26.0.50; alist-get: Add optional arg TESTFN
Date: Fri, 07 Jul 2017 11:53:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

> +  (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





reply via email to

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