Apply


Name:
Apply - calls a function with the elements of an array as arguments
Synopsis:
array proc Apply -> any  
Examples:
 

[1 2] {add} Apply --> 3
[1 2] {dup mul} Map --> [1 4]
[(hell world) 4 (o)] {insert} Apply --> (hello world)

Description:
 
Apply interprets the elements of the input array a as the list
of arguments of the supplied function f,
f(a(1),a(2), ...,a(n))

This is to be distinguished from Map which individually applies
the function to the elements of the array,
[f(a(1),f(a(2), ...,f(a(n))]

Parameters:
 
array is an arbitrarily shaped heterogeneous array.
proc is any procedure object (pure function).

Remarks:
 
This function is an implementation of Mathematica's Apply function.
References:
 
[1] The Mathematica Book V4.0 "Apply"
Author:
Diesmann  
FirstVersion:
unknown, documented 121124  
SeeAlso: Source:
/home/nest/work/nest-2.14.0/lib/sli/mathematica.sli