|
From: | Stefan Monnier |
Subject: | Re: Why is FUNC in cl-callf not allowed to be an expression? |
Date: | Mon, 20 May 2019 22:01:09 -0400 |
User-agent: | Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> Sorry that I haven't been clear: I want EXPR to eval to the function to > be applied, not to the expression to set to. Like in > > (cl-callf (with (if flag #'1+ #'1-)) my-number) Note that the gv-modify macro we discussed does not allow that either: it doesn't funcall the result of an EXPR. So, what you want can be written (cl-callf (lambda (x) (if flag (1+ x) (1- x))) my-number) or (cl-callf (lambda (x) (funcall (if flag #'1+ #'1-) x)) my-number) Just like you'd have to write (gv-modify my-number (if flag (1+ it) (1- it))) or (gv-modify my-number (funcall (if flag #'1+ #'1-) it)) Stefan
[Prev in Thread] | Current Thread | [Next in Thread] |