Книга: Practical Common Lisp
Function Calls
Function Calls
The evaluation rule for function call forms is simple: evaluate the remaining elements of the list as Lisp forms and pass the resulting values to the named function. This rule obviously places some additional syntactic constraints on a function call form: all the elements of the list after the first must themselves be well-formed Lisp forms. In other words, the basic syntax of a function call form is as follows, where each of the arguments is itself a Lisp form:
(function-name argument*)
Thus, the following expression is evaluated by first evaluating 1
, then evaluating 2
, and then passing the resulting values to the +
function, which returns 3:
(+ 1 2)
A more complex expression such as the following is evaluated in similar fashion except that evaluating the arguments (+ 1 2)
and (- 3 4)
entails first evaluating their arguments and applying the appropriate functions to them:
(* (+ 1 2) (- 3 4))
Eventually, the values 3 and -1 are passed to the *
function, which returns -3.
As these examples show, functions are used for many of the things that require special syntax in other languages. This helps keep Lisp's syntax regular.
- 5.5.1. Initialization via initcalls
- 16.3.3. Machine-Dependent Calls
- 6.5 Thread-safe functions
- EXTERNAL FUNCTION DIRECTORY
- CHAPTER 4 Functions and Libraries in mikroC
- Functions
- Basic Functions
- Using Functions in Shell Scripts
- 4.1 mikroC Functions
- 4.2 mikroC Built-in Functions
- 4.3 mikroC Library Functions
- 4.1.1 Function Prototypes