Subject: Re: What is the difference between FUNCALL and APPLY?
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 19 Apr 2007 02:54:41 -0500
Newsgroups: comp.lang.lisp
Message-ID: <b4adndrRv__cvbrbnZ2dnUVZ_tGvnZ2d@speakeasy.net>
QinGW  <dealover@21cn.com> wrote:
+---------------
| test code:
| >(apply #'list 1 nil)
| (1)
| >(funcall #'list 1 nil)
| (1 NIL)
| 
| How to explain their difference?
+---------------

By noticing that they are *defined* differently in the CL spec,
especially the definition of the &REST parameters of each:

  http://alu.org/HyperSpec/Body/fun_funcall.html
  ...
  args---ARGUMENTS to the function.

versus:

  http://alu.org/HyperSpec/Body/fun_apply.html
  ...
  args---a SPREADABLE ARGUMENT LIST DESIGNATOR.

You may very well need to look up the terms emphasized above
in the Glossary:

  http://alu.org/HyperSpec/Body/glo_a.html#argument
  http://alu.org/HyperSpec/Body/glo_s.html#spreadable_argument_list_designator

In particular, read the second one *very* carefully...


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607