-
-
Notifications
You must be signed in to change notification settings - Fork 810
/
Copy pathrepl.txt
106 lines (78 loc) · 2.56 KB
/
repl.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
{{alias}}( x, shape, colex, clbk[, thisArg] )
Flattens a five-dimensional nested array according to a callback function.
The function assumes that all nested arrays have the same length (i.e., the
input array is *not* a ragged array).
The callback function is provided the following arguments:
- value: nested array element.
- indices: element indices (in lexicographic order).
- arr: the input array.
Parameters
----------
x: ArrayLikeObject
Input array.
shape: Array<integer>
Array shape.
colex: boolean
Specifies whether to flatten array values in colexicographic order.
clbk: Function
Callback function.
thisArg: any (optional)
Callback execution context.
Returns
-------
out: Array
Flattened array.
Examples
--------
> function fcn( v ) { return v * 2; };
> var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
> var out = {{alias}}( x, [ 2, 1, 1, 1, 2 ], false, fcn )
[ 2, 4, 6, 8 ]
> out = {{alias}}( x, [ 2, 1, 1, 1, 2 ], true, fcn )
[ 2, 6, 4, 8 ]
{{alias}}.assign( x, shape, colex, out, stride, offset, clbk[, thisArg] )
Flattens a five-dimensional nested array according to a callback function
and assigns elements to a provided output array.
The function assumes that all nested arrays have the same length (i.e., the
input array is *not* a ragged array).
The callback function is provided the following arguments:
- value: nested array element.
- indices: element indices (in lexicographic order).
- arr: the input array.
Parameters
----------
x: Array
Input array.
shape: Array<integer>
Array shape.
colex: boolean
Specifies whether to flatten array values in colexicographic order.
out: Collection
Output array.
stride: integer
Output array stride.
offset: integer
Output array index offset.
clbk: Function
Callback function.
thisArg: any (optional)
Callback execution context.
Returns
-------
out: Array
Output array.
Examples
--------
> function fcn( v ) { return v * 2; };
> var x = [ [ [ [ [ 1, 2 ] ] ] ], [ [ [ [ 3, 4 ] ] ] ] ];
> var out = [ 0, 0, 0, 0 ];
> var v = {{alias}}.assign( x, [ 2, 1, 1, 1, 2 ], false, out, 1, 0, fcn )
[ 2, 4, 6, 8 ]
> var bool = ( v === out )
true
> out = [ 0, 0, 0, 0 ];
> {{alias}}.assign( x, [ 2, 1, 1, 1, 2 ], true, out, 1, 0, fcn );
> out
[ 2, 6, 4, 8 ]
See Also
--------