next up previous
Contents Next: Backquote and Commas Up: FunctionsLambda Expressions, Previous: Apply

Mapcar

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

The MAPCAR form is an "iterator" that applies a function repeatedly, to each element of a list and returns a list of the results. For example:

> (MAPCAR 'ATOM '(DOG (CAT HORSE) FISH))
(T NIL T)
> (MAPCAR '(LAMBDA (X) (* X X)) '(4 7 2 9))
(16 49 4 81)


© Colin Allen, John H. Remmers, & Maneesh Dhagat
November 1999