apply - call a procedure with a list of arguments
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
(apply procedure obj ... pair)
with the elements of the list
as the actual arguments.
(append (list obj ...) pair)
returns the values returned by
is called in the manner above.
is usually used to call a procedure where the set of arguments to give to the procedure is not known ahead of time.
can also be used to perform a simple "fold" over a list of items if
can take an arbitrary number of arguments. For example:
(apply + (list 1 2 3 4)) => 10
This procedure can raise exceptions with the following condition types:
- &assertion (R6RS)
The wrong number of arguments was passed or an argument was outside its domain.
The assertions described above are errors.
Implementations may signal an error, extend the procedure's
domain of definition to include such arguments,
or fail catastrophically.
This page is part of the
It includes materials from the RnRS documents.
More information can be found at
Markup created by unroff 1.0sc, March 04, 2023.