Difference between revisions of "Array.$ ()"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "Array.$_(Function|Array of Functions[,param1,param2,...]) This returns the result of all of the Array being operated on by the function or array of functions passed. The par...")
 
Line 1: Line 1:
 +
==Array Aggregate Function to Entire Array==
 +
 
Array.$_(Function|Array of Functions[,param1,param2,...])  
 
Array.$_(Function|Array of Functions[,param1,param2,...])  
  

Revision as of 11:39, 4 February 2020

Array Aggregate Function to Entire Array

Array.$_(Function|Array of Functions[,param1,param2,...])

This returns the result of all of the Array being operated on by the function or array of functions passed. The parameters provided following the function/function array is passed to the function with all elements of array as the first parameter. Used for aggregate functions or functions that apply on entire array.

For example, a=|4,4,1..10|

1 2 3 4
5 6 7 8
9 10 1 2
3 4 5 6

a.$_(SUM)

76

Functions can be defined as a string with a variable, say, x. The function may depend on x[a1,a2] etc accessors for the element at a1, a2.

a.$_("x[1][1]+x[2][2]")

7