emacs-devel
[Top][All Lists]
Advanced

[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: Stefan Monnier
Subject: Re: Why is FUNC in cl-callf not allowed to be an expression?
Date: Fri, 10 May 2019 09:28:14 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>> > (defmacro gv-callf (call &optional n)
>> >   (gv-letplace (_getter setter) (nth (or n 1) call)
>> >     (funcall setter call)))
>>
>> It's cute, tho I'm not too fond of specifying the place via a number,
>> personally,
>
> [I should use GETTER btw for more efficient code:
>
> (defmacro gv-callf (call &optional n)
>   (unless n (setq n 1))
>   (gv-letplace (getter setter) (nth n call)
>     (setf (nth n call) getter)
>     (funcall setter call)))
> ]
>
> Yes, but still better than having it as part of the macro name as in
> cl-callf2... I don't have any better idea currently.  We could still
> extend cl-callf however.

While it doesn't solve the problem, while playing with it I noticed that
I'm less annoyed by the use of a number if I can put it first, as in:

    (gv-callf 2
      (append head (car x) (cdr x)))
      
I'm not sure I can say why, tho.


        Stefan



reply via email to

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