From: "Pascal J. Bourguignon" <pjb@informatimago.com>
To: help-gnu-emacs@gnu.org
Subject: Re: About `funcall'
Date: Tue, 05 Mar 2013 00:23:08 +0100 [thread overview]
Message-ID: <87y5e2vjfn.fsf@kuiper.lan.informatimago.com> (raw)
In-Reply-To: mailman.21404.1362437985.855.help-gnu-emacs@gnu.org
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 {}.
next parent reply other threads:[~2013-03-04 23:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.21404.1362437985.855.help-gnu-emacs@gnu.org>
2013-03-04 23:23 ` Pascal J. Bourguignon [this message]
2013-03-04 22:59 About `funcall' Xue Fuqiao
[not found] <mailman.21339.1362401601.855.help-gnu-emacs@gnu.org>
2013-03-04 19:12 ` Raffaele Ricciardi
2013-03-04 19:15 ` Pascal J. Bourguignon
-- strict thread matches above, loose matches on Subject: below --
2013-03-04 12:52 Xue Fuqiao
2013-03-04 12:57 ` Xue Fuqiao
[not found] ` <mailman.21340.1362401871.855.help-gnu-emacs@gnu.org>
2013-03-04 14:11 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y5e2vjfn.fsf@kuiper.lan.informatimago.com \
--to=pjb@informatimago.com \
--cc=help-gnu-emacs@gnu.org \
/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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).