next up previous
Contents Next: Eval Up: Lisp Primer Previous: Converting Strings to

Functions, Lambda Expressions, and Macros

[We are grateful to John H. Remmers for allowing material from his programming languages course to be incorporated into this section.]

Lisp incorporates a "functional programming" paradigm. A central feature of this paradigm is that functions are "first class" objects that can be referenced, operated upon, and returned by operators referred to as functionals. By contrast, in traditional procedural languages the first class objects are normally just passive data objects such as numbers, characters, and strings.

In a functional language, programming involves applying functionals in various ways instead of manipulating variables by assignments, loops, etc.

Common Lisp is not a "pure" functional language, because it contains constructs such as SETQ, LET, and DOTIMES that mimic the assignment, local scope, and loop features found in procedural languages. However, Lisp does contain a number of functionals and supports a functional style of programming.

Some of the most important and commonly used functionals are described below, along with other elements of Lisp such as eval and defmacro that support functional programming.





© Colin Allen, John H. Remmers, & Maneesh Dhagat
March 2007