Difference between revisions of "Array.$ ()"

From ZCubes Wiki
Jump to navigation Jump to search
 
Line 1: Line 1:
 +
*[[ Z3 | << Z3 Home ]]
 +
*[[ Z%5E3_Language_Documentation | Z3 Language Documentation]]
 +
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
 +
 
==Array Aggregate Function to Entire Array==  
 
==Array Aggregate Function to Entire Array==  
  

Latest revision as of 05:51, 8 April 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