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 each column of the Array being operated on by the function or array of functions passed...")
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
Array.$$$(Function|Array of Functions[,param1,param2,...])  
+
*[[ Z3 | << Z3 Home ]]
 +
*[[ Z%5E3_Language_Documentation | Z3 Language Documentation]]
 +
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
 +
 
 +
==Array.$$$(Function|Array of Functions[,param1,param2,...]) ==
  
 
This returns the result of each column 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 each column as the first parameter. Used for aggregate functions or functions that apply on each column (such as a vertical spreadsheet calculation).  
 
This returns the result of each column 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 each column as the first parameter. Used for aggregate functions or functions that apply on each column (such as a vertical spreadsheet calculation).  
Line 29: Line 33:
  
 
gives row wise sums of each row.
 
gives row wise sums of each row.
 +
 +
Functions can be defined as a string with a variable, say, x. The following shows a calculation done in each column by subracting second from the first element in each column.
 +
 +
a.$$$("[x[2],x[0],x[2]-x[0]]")
 +
 +
{| class="wikitable"|-
 +
|
 +
{| class="wikitable"|-
 +
| 9 || 1 || 8
 +
|}
 +
 +
|-
 +
|
 +
{| class="wikitable"|-
 +
| 10 || 2 || 8
 +
|}
 +
 +
|-
 +
|
 +
{| class="wikitable"|-
 +
| 1 || 3 || -2
 +
|}
 +
 +
|-
 +
|
 +
{| class="wikitable"|-
 +
| 2 || 4 || -2
 +
|}
 +
 +
|}

Latest revision as of 11:24, 1 March 2017

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

This returns the result of each column 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 each column as the first parameter. Used for aggregate functions or functions that apply on each column (such as a vertical spreadsheet calculation).

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)

18
22
16
20

gives row wise sums of each row.

Functions can be defined as a string with a variable, say, x. The following shows a calculation done in each column by subracting second from the first element in each column.

a.$$$("[x[2],x[0],x[2]-x[0]]")

9 1 8
10 2 8
1 3 -2
2 4 -2