[Next] [Previous] [Up] [Top] [Contents] [Index]

12 The Built-In Functions

Function Application

apply [Function]


Applies a function to arguments.

Signature:
apply function argument #rest more-arguments Þ #rest values

Arguments:
function An instance of <function>.

argument
An instance of <object> or, if there are no more-arguments, an instance of <sequence>.

more-arguments
Instances of <object>. The last more-arguments must be an instance of <sequence>.

Values:
values Instances of <object>.

Description:
Calls function and returns the values which function returns. The argument and more-arguments supply the arguments to function. All but the last of argument and more-arguments are passed to function individually. The last of argument and more-arguments must be a sequence. This sequence is not passed as a single argument to function. Instead, its elements are taken individually as arguments to function.

apply(max, list(3, 1, 4, 1, 5, 9))
  Þ  9
apply(min 5, 7 list(3, 1, 4))
  Þ  1
define constant make-string =
       method (#rest init-args) => string :: <string>;
         apply(make, <string>, init-args)
       end;
make-string(fill: 'a', size: 10)
  Þ  "aaaaaaaaaa"

Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker