A mapping function applies a function to each of a collection of
objects. Jade currently has two mapping functions, mapcar and
mapc.
The function should be able to be called with one argument.
(mapcar '1+ '(1 2 3 4 5))
=> (2 3 4 5 6)
mapcar except that the values returned when each element
is applied to the function function are discarded. The value returned
is list.
This function is generally used where the side effects of calling the function are the important thing, not the results.
The two following functions are also mapping functions of a sort. They
are variants of the delete function (see section Modifying Lists)
and use predicate functions to classify the elements of the list
which are to be deleted.
delete function. Instead of
comparing each element of list with a specified object, each
element of list is applied to the predicate function predicate.
If it returns t (i.e. not nil) then the element is destructively
removed from list.
(delete-if 'stringp '(1 "foo" 2 "bar" 3 "baz"))
=> (1 2 3)
delete-if. It applies predicate
to each element of list, if it returns nil then the element
is destructively removed from the list.
(delete-if-not 'stringp '(1 "foo" 2 "bar" 3 "baz"))
=> ("foo" "bar" "baz")
Go to the first, previous, next, last section, table of contents.