Node:Args as Variable or List, Next:, Previous:Data types, Up:Arguments



1.8.2 An Argument as the Value of a Variable or List

An argument can be a symbol that returns a value when it is evaluated. For example, when the symbol fill-column by itself is evaluated, it returns a number. This number can be used in an addition.

Position the cursor after the following expression and type C-x C-e:

(+ 2 fill-column)

The value will be a number two more than what you get by evaluating fill-column alone. For me, this is 74, because the value of fill-column is 72.

As we have just seen, an argument can be a symbol that returns a value when evaluated. In addition, an argument can be a list that returns a value when it is evaluated. For example, in the following expression, the arguments to the function concat are the strings "The " and " red foxes." and the list (number-to-string (+ 2 fill-column)).

(concat "The " (number-to-string (+ 2 fill-column)) " red foxes.")

If you evaluate this expression--and if, as with my Emacs, fill-column evaluates to 72--"The 74 red foxes." will appear in the echo area. (Note that you must put spaces after the word The and before the word red so they will appear in the final string. The function number-to-string converts the integer that the addition function returns to a string. number-to-string is also known as int-to-string.)