GNU Info

Info Node: (emacs-lisp-intro.info)Arguments

(emacs-lisp-intro.info)Arguments


Next: set & setq Prev: Variables Up: List Processing
Enter node , (file) or (file)node

Arguments
=========

   To see how information is passed to functions, let's look again at
our old standby, the addition of two plus two.  In Lisp, this is written
as follows:

     (+ 2 2)

   If you evaluate this expression, the number 4 will appear in your
echo area.  What the Lisp interpreter does is add the numbers that
follow the `+'.

   The numbers added by `+' are called the "arguments" of the function
`+'.  These numbers are the information that is given to or "passed" to
the function.

   The word `argument' comes from the way it is used in mathematics and
does not refer to a disputation between two people; instead it refers to
the information presented to the function, in this case, to the `+'.
In Lisp, the arguments to a function are the atoms or lists that follow
the function.  The values returned by the evaluation of these atoms or
lists are passed to the function.  Different functions require
different numbers of arguments; some functions require none at all.(1)

Data types
Types of data passed to a function.
Args as Variable or List
An argument can be the value
of a variable or list.
Variable Number of Arguments
Some functions may take a
variable number of arguments.
Wrong Type of Argument
Passing an argument of the wrong type
to a function.
message
A useful function for sending messages.
   ---------- Footnotes ----------

   (1) It is curious to track the path by which the word `argument'
came to have two different meanings, one in mathematics and the other in
everyday English.  According to the `Oxford English Dictionary', the
word derives from the Latin for `to make clear, prove'; thus it came to
mean, by one thread of derivation, `the evidence offered as proof',
which is to say, `the information offered', which led to its meaning in
Lisp.  But in the other thread of derivation, it came to mean `to
assert in a manner against which others may make counter assertions',
which led to the meaning of the word as a disputation.  (Note here that
the English word has two different definitions attached to it at the
same time.  By contrast, in Emacs Lisp, a symbol cannot have two
different function definitions at the same time.)


automatically generated by info2www version 1.2.2.9