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

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

Re: [h-e-w] Help with defadvice


From: Craig R. Steury
Subject: Re: [h-e-w] Help with defadvice
Date: 19 Jun 2003 15:51:29 -0400



> 
> My elisp is not so good either, but as far as I know, apply breaks a list
> apart into separate items, calling the function with the "spread" list as
> arguments, while concat does not accept a list:
> 
> (apply 'concat '("this " "is " "a " "test"))
> "this is a test"


Here's the signature for 'apply' from the Common Lisp manual (close enough to
elisp for this example):

  apply function arg &rest more-args

&rest means the unspecified (and optional) number of more-args is built into an
implicit list.

apply is very flexible (good for building argument lists on the fly, etc) but
builds its argument list by appending the *last* argument supplied (it better
be a list!) to the list of all the rest of the arguments present.  This is hard
to explain - but here are some examples of valid 'apply' use:

(apply '+ '(1 2))        ==> 3  ;like your example
(apply '+ 1 2 (list 3))  ==> 6
(apply '+ 1 nil)         ==> 1


cs

Craig Steury
Parametric Technology Corp.
(801) 588-4613 (w)
Salt Lake City, UT 84108

address@hidden






reply via email to

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