© Gary D. Knott 2017

Gary D. Knott, Interpreting LISP, 10.1007/978-1-4842-2707-7_12

12. Defining Functions: λ-Expressions

Gary D. Knott

(1)Civilized Software Inc., Silver Spring, Maryland, USA

We can use the LISP interpreter to compute the value of combinations of built-in functions and special forms applied to arguments, but to use LISP as a programming language rather than as a curious kind of calculator, we must have a way to define functions of our own choosing and use them, rather than just use unnamed compositions of preexisting functions.

The special form LAMBDA is used in LISP to create a user-defined function. LAMBDA takes two arguments, which are both S-expressions. The first argument is a list of ordinary atoms denoting the formal arguments ...

Get Interpreting LISP: Programming and Data Structures, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.