apply
The procedure apply
allows you to call any procedure, and
specify a list of values to be passed as arguments. apply
takes a procedure and a list of values, and then calls the procedure
with those values as arguments.
For example, (apply + '(1 2))
passes the values 1
and
2
to +
, and is equivalent to (+ 1 2)
.
You'll seldom need to use apply
, because normal procedure
calling works fine in most situations. Occasionally, though, it is
convenient to be able to apply a procedure to a list of values
that have already been computed. (I'll show an example in [ chapter 4? ].)