Difference between revisions of "Array nth Functions"

From ZCubes Wiki
Jump to navigation Jump to search
(Created page with "* << Z3 Home * Z3 Language Documentation * Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member F...")
 
 
(9 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
 
*[[ Z%5E3_Array_Manipulation_Member_Functions | Listing of Z3 Array Manipulation Member Functions]]
  
 +
See [[Array_Find_Related_Functions | Array Find Related Functions]]
  
==Array.nth(SomeNth, SomeCount) ==
+
==Array.nth(SomeNth, SomeCount, IsBothSides) ==
  
Get the nth element from the array. SomeCount (default as 1) of elements from the nth index is given.
+
Array.ends() is the same function, but returns elements from front and back, and uses the same parameters.
 +
 
 +
Get the nth element from the array. SomeCount (default as 1) of elements from the nth index is given. Result is an array. IsBothSides (false by default), if true, will give the result from beginning and the end of the array. These parameters can be given as an array to do combinatorial loops.
 +
 
 +
If the first element is required, use the Array.firstelement() or Array.lastelement().
 +
 
 +
Note that Array.first(Count) and Array.last(Count) give array of numbers as result.
  
 
The following are the easier way to get the xth element from an array. If multidimensional array, it gives the xth row.
 
The following are the easier way to get the xth element from an array. If multidimensional array, it gives the xth row.
  
 
Array.first
 
Array.first
 +
 +
Array.last
 +
 
Array.second
 
Array.second
 +
 
Array.third
 
Array.third
 +
 
Array.fourth
 
Array.fourth
 +
 
Array.fifth
 
Array.fifth
 +
 
Array.sixth
 
Array.sixth
 +
 
Array.seventh
 
Array.seventh
 +
 
Array.eighth
 
Array.eighth
 +
 
Array.nineth
 
Array.nineth
 +
 
Array.tenth
 
Array.tenth
 +
 
Array.eleventh
 
Array.eleventh
 +
 
Array.twelfth
 
Array.twelfth
 +
 
Array.thirteenth
 
Array.thirteenth
 +
 
Array.fourteenth
 
Array.fourteenth
 +
 
Array.fifteenth
 
Array.fifteenth
 +
 
Array.sixteenth
 
Array.sixteenth
 +
 
Array.seventeenth
 
Array.seventeenth
 +
 
Array.eighteenth
 
Array.eighteenth
 +
 
Array.nineteenth
 
Array.nineteenth
 +
 
Array.twentieth
 
Array.twentieth
 +
 
Array.hundredth
 
Array.hundredth
 +
 
Array.thousandth
 
Array.thousandth
 +
 
Array.millionth
 
Array.millionth
  
Line 46: Line 77:
 
| 7 || 25 || 13 || 1 || 19  
 
| 7 || 25 || 13 || 1 || 19  
 
|}
 
|}
 +
 +
==Array element ==
 +
 +
===Array.firstelement===
 +
 +
Gives first element.
 +
 +
===Array.lastelement===
 +
 +
Gives last element.
 +
 +
==NTHELEMENT(nTh, Array)==
 +
 +
Return the nth element from Array.
 +
 +
The following will give the 1st to 10th element in an array.
 +
 +
ELEMENT1
 +
ELEMENT2
 +
ELEMENT3
 +
ELEMENT4
 +
ELEMENT5
 +
ELEMENT6
 +
ELEMENT7
 +
ELEMENT8
 +
ELEMENT9
 +
ELEMENT10
 +
 +
 +
ELEMENT9(1..10)
 +
 +
9
 +
 +
1..10.firstelement()
 +
 +
1
 +
 +
1..10.lastelement()
 +
 +
10

Latest revision as of 15:13, 13 September 2024

See Array Find Related Functions

Array.nth(SomeNth, SomeCount, IsBothSides)

Array.ends() is the same function, but returns elements from front and back, and uses the same parameters.

Get the nth element from the array. SomeCount (default as 1) of elements from the nth index is given. Result is an array. IsBothSides (false by default), if true, will give the result from beginning and the end of the array. These parameters can be given as an array to do combinatorial loops.

If the first element is required, use the Array.firstelement() or Array.lastelement().

Note that Array.first(Count) and Array.last(Count) give array of numbers as result.

The following are the easier way to get the xth element from an array. If multidimensional array, it gives the xth row.

Array.first

Array.last

Array.second

Array.third

Array.fourth

Array.fifth

Array.sixth

Array.seventh

Array.eighth

Array.nineth

Array.tenth

Array.eleventh

Array.twelfth

Array.thirteenth

Array.fourteenth

Array.fifteenth

Array.sixteenth

Array.seventeenth

Array.eighteenth

Array.nineteenth

Array.twentieth

Array.hundredth

Array.thousandth

Array.millionth

1..5.second()

2


MAGICSQUARE(5).third()

7 25 13 1 19

Array element

Array.firstelement

Gives first element.

Array.lastelement

Gives last element.

NTHELEMENT(nTh, Array)

Return the nth element from Array.

The following will give the 1st to 10th element in an array.

ELEMENT1 ELEMENT2 ELEMENT3 ELEMENT4 ELEMENT5 ELEMENT6 ELEMENT7 ELEMENT8 ELEMENT9 ELEMENT10


ELEMENT9(1..10)

9

1..10.firstelement()

1

1..10.lastelement()

10