From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: emacs-devel@gnu.org
Subject: Re: Why is FUNC in cl-callf not allowed to be an expression?
Date: Mon, 20 May 2019 22:01:09 -0400 [thread overview]
Message-ID: <jwv1s0sa7sy.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87k1ek673s.fsf@web.de> (Michael Heerdegen's message of "Tue, 21 May 2019 01:25:59 +0200")
> 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
next prev parent reply other threads:[~2019-05-21 2:01 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-09 21:52 Why is FUNC in cl-callf not allowed to be an expression? Michael Heerdegen
2019-05-10 0:47 ` Stefan Monnier
2019-05-10 11:32 ` Michael Heerdegen
2019-05-10 13:28 ` Stefan Monnier
2019-05-10 14:19 ` Stefan Monnier
2019-05-10 14:22 ` Stefan Monnier
2019-05-10 15:18 ` Michael Heerdegen
2019-05-13 16:47 ` Stefan Monnier
2019-05-14 12:36 ` Michael Heerdegen
2019-05-14 23:32 ` Michael Heerdegen
2019-05-15 2:02 ` Stefan Monnier
2019-05-15 16:38 ` Michael Heerdegen
2019-05-15 17:19 ` Michael Heerdegen
2019-05-16 2:18 ` Michael Heerdegen
2019-05-16 13:12 ` Stefan Monnier
2019-05-16 14:37 ` Michael Heerdegen
2019-05-16 15:09 ` Michael Heerdegen
2019-05-16 19:34 ` Stefan Monnier
2019-05-16 21:46 ` Michael Heerdegen
2019-05-16 23:06 ` Stefan Monnier
2019-05-17 22:53 ` Michael Heerdegen
2019-05-18 14:09 ` Stefan Monnier
2019-05-20 23:25 ` Michael Heerdegen
2019-05-21 2:01 ` Stefan Monnier [this message]
2019-05-21 2:47 ` Michael Heerdegen
2019-05-21 10:16 ` Noam Postavsky
2019-05-21 16:38 ` Michael Heerdegen
2019-05-21 17:38 ` Stefan Monnier
2019-05-21 7:26 ` Andy Moreton
2019-05-23 23:02 ` Michael Heerdegen
2019-05-22 1:00 ` Michael Heerdegen
2019-05-23 1:50 ` Michael Heerdegen
2019-05-23 3:38 ` Stefan Monnier
2019-05-23 23:38 ` Michael Heerdegen
2019-05-24 15:29 ` Stefan Monnier
2019-05-28 19:54 ` Michael Heerdegen
2019-05-27 0:20 ` Michael Heerdegen
2019-05-29 17:02 ` Stefan Monnier
2019-05-15 19:17 ` Michael Heerdegen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwv1s0sa7sy.fsf-monnier+emacs@gnu.org \
--to=monnier@iro.umontreal.ca \
--cc=emacs-devel@gnu.org \
--cc=michael_heerdegen@web.de \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.