www.delorie.com/gnu/docs/emacs-lisp-intro/emacs-lisp-intro_26.html   search  
 
Buy the book!


Programming in Emacs Lisp

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

1.8 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)

1.8.1 Arguments' Data Types  Types of data passed to a function.
1.8.2 An Argument as the Value of a Variable or List  An argument can be the value of a variable or list.
1.8.3 Variable Number of Arguments  Some functions may take a variable number of arguments.
1.8.4 Using the Wrong Type Object as an Argument  Passing an argument of the wrong type to a function.
1.8.5 The message Function  A useful function for sending messages.


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003