Array.indices()

Revision as of 10:39, 6 March 2017 by Joseph (talk | contribs) (Created page with "* << Z3 Home * Z3 Language Documentation * Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member F...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

These functions operate on array locations and values to create contours and other interesting operations. Array_Indices_and_XY_Functions

Array.indices(Function,SubtractByArray,ScaleByArray,DoNotShowIndices,RowArray)

Returns the result of applying the Function/FunctionSet to each x,y location of the array, then subtracts and scales the results with SubtractByArray and ScaleByArray. DoNotShowIndices suppresses the x,y indices when outputting the result.

[1,2,3].indices(SIN).print()

[ [ [0,0 ] ],

[ [1,0.8414709848078965 ] ],

[ [2,0.9092974268256817 ] ] ]

MAGICSQUARE(3).indices()

0 0 0 0
0 1 0 1
0 2 0 2
1 0 1 0
1 1 1 1
1 2 1 2
2 0 2 0
2 1 2 1
2 2 2 2


MAGICSQUARE(3).indices(SUM,0,1,false)

0 0 0
0 1 1
0 2 2
1 0 1
1 1 2
1 2 3
2 0 2
2 1 3
2 2 4

0 1 2 1 2 3 2 3 4 MAGICSQUARE(3).indices(SUM,0,1,true)

0
1
2
1
2
3
2
3
4