Difference between revisions of "Array.pip()"
(3 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]] | ||
− | ==Array.pip(SomePathIndexArray, SomeLength, SomePassThroughFunction) == | + | ==Array.pip(SomePathIndexArray, SomeLength, SomePassThroughFunction,UseClone) == |
*pip is push plus insert. The array is split at the nodes in SomePathIndexArray, and a slice of length SomeLength is pushed into these array indices, and the values are massaged with SomePassThroughFunction if provided. | *pip is push plus insert. The array is split at the nodes in SomePathIndexArray, and a slice of length SomeLength is pushed into these array indices, and the values are massaged with SomePassThroughFunction if provided. | ||
− | *pip modifies the original array. | + | *pip modifies the original array, unless UseClone is true. |
*SomePathIndexArray is array indices to refer to a specific cell in the array to be pip-ed. | *SomePathIndexArray is array indices to refer to a specific cell in the array to be pip-ed. | ||
Line 41: | Line 41: | ||
[4,3,8 ] | [4,3,8 ] | ||
] | ] | ||
+ | |||
+ | |||
+ | MAGICSQUARE(3).pip([1,1],2,x=>SUM(x)).print() | ||
+ | |||
+ | [ | ||
+ | [2,7,6 ], | ||
+ | |||
+ | [9,6 ], | ||
+ | |||
+ | [4,3,8 ] | ||
+ | ] | ||
+ | |||
+ | ==Related== | ||
+ | |||
+ | [[Array.pipall()|pipall ]] | ||
+ | |||
+ | [[Array.pipall()|pipallwithslice ]] | ||
+ | |||
+ | [[Array.pipall()|reversepip ]] |
Latest revision as of 11:22, 5 February 2020
Array.pip(SomePathIndexArray, SomeLength, SomePassThroughFunction,UseClone)
- pip is push plus insert. The array is split at the nodes in SomePathIndexArray, and a slice of length SomeLength is pushed into these array indices, and the values are massaged with SomePassThroughFunction if provided.
- pip modifies the original array, unless UseClone is true.
- SomePathIndexArray is array indices to refer to a specific cell in the array to be pip-ed.
Example: 1..10.pip(5,2)
1
2
3
4
5
6 7
8
9
10
MAGICSQUARE(3).pip([1,1],2).print()
[ [2,7,6 ],
[9, [5,1 ] ],
[4,3,8 ] ]
MAGICSQUARE(3).pip([1,1],2,x=>SUM(x)).print()
[ [2,7,6 ],
[9,6 ],
[4,3,8 ] ]
Related
pipallwithslice
reversepip