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

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

Re: About `funcall'


From: Pascal J. Bourguignon
Subject: Re: About `funcall'
Date: Tue, 05 Mar 2013 00:23:08 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

Xue Fuqiao <xfq.free@gmail.com> writes:

>> Xue Fuqiao <xfq.free@gmail.com> writes:
>>
>>> In `yank-pop', there is an sexp about `funcall':
>>>
>>>   (funcall (or yank-undo-function 'delete-region) (point) (mark t))
>>>
>>> IIRC the first argument for `funcall' should be a function, so I'm
>>> confused with this usage.  Can somebody explain it to me?  Thanks.
>>
>> `or' returns the first argument that is not nil, or nil when all the
>> arguments are nil.
>
> I see, thanks.
>
>>     (defmacro .or (&rest args)
>>       (if (null args)
>>          'nil
>>          (let ((var (gensym)))
>>           `(let ((,var ,(first args)))
>>              (if ,var
>>                 ,var
>>                 (.or ,@(rest args)))))))
>>
>>     (macroexpand '(.or a b))
>>     --> (let ((#1=#:G90861 a)) (if #1# #1# (\.or b)))--
>
> What does "(first args)" mean here?  Does it mean "(car args)"?

Yes.  And (rest args) is the same as (cdr args).

But since I consider here args to be a list, and not a cons cell, then I
use first and rest.  I use car and cdr only when I consider cons cells.


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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