From: Philip Kaludercic <philipk@posteo.net>
To: Rodrigo Morales <moralesrodrigo1100@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Could anyone explain why example no. 4 is different from the others?
Date: Thu, 17 Aug 2023 10:41:23 +0000 [thread overview]
Message-ID: <87leeagdd8.fsf@posteo.net> (raw)
In-Reply-To: <CAGxMbPYv-CvRg5Q0stJ3xfR6hraoOGzn3Z+pWe1J52U7=66=wg@mail.gmail.com> (Rodrigo Morales's message of "Thu, 17 Aug 2023 03:15:50 +0000")
Rodrigo Morales <moralesrodrigo1100@gmail.com> writes:
> Could anyone explain why example no. 4 is different from the others?
> Example no. 1
>
> ,----
> | (append '(nil) '(nil) '(nil))
> `----
>
> ,----
> | (nil nil nil)
> `----
>
> Example no. 2
>
> ,----
> | (funcall 'append '(nil) '(nil) '(nil))
> `----
This is equivalent to example 1.
> ,----
> | (nil nil nil)
> `----
>
> Example no. 3
>
> ,----
> | (apply 'append '((nil) (nil) (nil)))
> `----
This is also equivalent to example 1.
> ,----
> | (nil nil nil)
> `----
>
> Example no. 4
>
> ,----
> | (apply 'append '(nil) '(nil) '(nil))
> `----
This is equivalent to
(funcall 'append '((nil) (nil) . (nil)))
or
(append '(nil) '(nil) nil)
because with apply, the last argument is used to call a function with
variadic arguments.
In general, (funcall 'foo a b c ...) is the same as (apply 'foo (list a
b c ...)).
> ,----
> | (nil nil)
> `----
prev parent reply other threads:[~2023-08-17 10:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-17 3:15 Could anyone explain why example no. 4 is different from the others? Rodrigo Morales
2023-08-17 4:32 ` tomas
2023-08-17 10:41 ` Philip Kaludercic [this message]
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=87leeagdd8.fsf@posteo.net \
--to=philipk@posteo.net \
--cc=help-gnu-emacs@gnu.org \
--cc=moralesrodrigo1100@gmail.com \
/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.