apply - call a procedure with a list of arguments
LIBRARY
(import (rnrs)) ;R6RS
(import (rnrs base)) ;R6RS
(import (scheme r5rs)) ;R7RS
(import (scheme base)) ;R7RS
SYNOPSIS
(apply procedure obj ... pair)
DESCRIPTION
The
apply
procedure calls
procedure
with the elements of the list
-
(append (list obj ...) pair)
as the actual arguments.
RETURN VALUES
apply
returns the values returned by
procedure
when
procedure
is called in the manner above.
EXAMPLES
APPLICATION USAGE
apply
is usually used to call a procedure where the set of arguments to give to the procedure is not known ahead of time.
apply
can also be used to perform a simple "fold" over a list of items if
procedure
can take an arbitrary number of arguments. For example:
-
(apply + (list 1 2 3 4)) => 10
RATIONALE
COMPATIBILITY
ERRORS
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.
- R7RS
-
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.
SEE ALSO
STANDARDS
R4RS,
IEEE Scheme,
R5RS,
R6RS,
R7RS
HISTORY
AUTHORS
This page is part of the
scheme-manpages
project.
It includes materials from the RnRS documents.
More information can be found at
https://github.com/schemedoc/manpages/
.
Markup created by unroff 1.0sc, March 04, 2023.