[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is FUNC in cl-callf not allowed to be an expression?
From: |
Andy Moreton |
Subject: |
Re: Why is FUNC in cl-callf not allowed to be an expression? |
Date: |
Tue, 21 May 2019 08:26:03 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2.50 (windows-nt) |
On Mon 20 May 2019, Stefan Monnier wrote:
>> 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)
The documentation for `cl-callf' says:
Set PLACE to (FUNC PLACE ARGS...).
FUNC should be an unquoted function name. PLACE may be a symbol,
or any generalized variable allowed by ‘setf’.
Please update this (and `cl-callf2') to show that FUNC can be a lambda.
Thanks,
AndyM
- Re: Why is FUNC in cl-callf not allowed to be an expression?, (continued)
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/16
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/16
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/17
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/18
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/20
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Noam Postavsky, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?,
Andy Moreton <=
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/23
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/21
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/22
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/22
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/23
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/24
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/28
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/26
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Stefan Monnier, 2019/05/29
- Re: Why is FUNC in cl-callf not allowed to be an expression?, Michael Heerdegen, 2019/05/15