Classes
Methods
(inner) array_append(array)
- Source:
Add items to the end of the array
Example
var a = [ 1, 2, 3 ];
array_append( a, 4, 5 );
a --> [ 1, 2, 3, 4, 5 ];
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
... |
items |
(inner) array_bisect_left(array, value, startopt, stopopt) → {Number}
- Source:
Locate the leftmost insertion point for value in array to maintain sorted order. The parameters lo and hi may be used to specify a subset of the list which should be considered; by default the entire list is used.
Example
array_bisect( _arange( 5 ), 2.5 ) --> 3
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | Must be sorted |
||
value |
Any | |||
start |
Number |
<optional> |
0
|
|
stop |
Number |
<optional> |
array_length(array)
|
Returns:
- Type
- Number
(inner) array_bisect_right(array, value, startopt, stopopt) → {Number}
- Source:
Locate the rightmost insertion point for value in array to maintain sorted order. The parameters lo and hi may be used to specify a subset of the list which should be considered; by default the entire list is used.
Example
array_bisect( _arange( 5 ), 2.5 ) --> 3
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | Must be sorted |
||
value |
Any | |||
start |
Number |
<optional> |
0
|
|
stop |
Number |
<optional> |
array_length(array)
|
Returns:
- Type
- Number
(inner) array_clear(array)
- Source:
Remove all elements from the array.
Example
var a = [ 1, 2, 3 ];
array_clear( a );
a --> [ ];
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
(inner) array_clone(array)
- Source:
Returns copy of the input array.
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
(inner) array_concat() → {Array}
- Source:
Concatenates arrarguments into a new array.
Example
array_concat( [ 1, 2 ], 3, [ 4, 5 ] ) --> 1, 2, 3, 4, 5
Parameters:
Name | Type | Description |
---|---|---|
... |
Array |
Returns:
- Type
- Array
(inner) array_count(array, value) → {Number}
- Source:
Return the number of times x appears in the array.
Example
array_count( [ 2, 3, 4, 3, 10, 3, 5, 6, 3 ], 3 ) --> 4
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
value |
Any |
Returns:
- Type
- Number
(inner) array_extend(array, iterable)
- Source:
Extend the array by appending all the items from the iterable.
Example
var a = [ 1, 2, 3 ];
array_extend( a, [ 4, 5 ] );
a --> [ 1, 2, 3, 4, 5 ];
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
iterable |
Iterable |
(inner) array_flat(array, depthopt) → {Array}
- Source:
Reduces array dimensions to 1. If depth supplied, flattens the array partially.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
depth |
Number |
<optional> |
infinity
|
Returns:
- Type
- Array
(inner) array_index(array, value, startopt, stopopt) → {Number}
- Source:
Return zero-based index in the list of the first item whose value is equal to given value. Returns undefined if no such item.
Example
array_index( [ 1, 2, 3, 4, 1, 1, 1, 4, 5 ], 4 ) --> 3
array_index( [ 1, 2, 3, 4, 1, 1, 1, 4, 5 ], 4, 4 ) --> 7
array_index( [ 1, 2, 3, 4, 1, 1, 1, 4, 5 ], 4, 4, 6 ) --> undefined
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
value |
Any | |||
start |
Number |
<optional> |
0
|
|
stop |
Number |
<optional> |
infinity
|
Returns:
- Type
- Number
(inner) array_map(array, func)
- Source:
Applies function to every item of input aray
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
func |
Method |
(inner) array_remove(array, value)
- Source:
Removes array element at given position
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
value |
Any |
(inner) array_reshape(array, shape) → {Array}
- Source:
Fills elements from one-dimensional array into a new shape.
Example
array_reshape( [ 0, 1, 2, 3, 4, 5 ] , [ 2, 3 ] ) --> [ [ 0, 1, 2 ], [ 3, 4, 5 ] ]
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
shape |
Array |
Returns:
- Type
- Array
(inner) array_reverse(array)
- Source:
Reverse the elements of the array in place
Example
var a = [ 1, 2, 3, 4, 5 ];
array_reverse( a );
a --> [ 5, 4, 3, 2, 1 ];
Parameters:
Name | Type | Description |
---|---|---|
array |
Array |
(inner) array_shape(array, row_firstopt) → {Array}
- Source:
Returns array shape
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
row_first |
Bool |
<optional> |
true
|
Returns:
- Type
- Array
(inner) array_slice(array, startopt, stopopt, stepopt) → {Array}
- Source:
Return part of the array.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
start |
Number |
<optional> |
0
|
|
stop |
Number |
<optional> |
infinity
|
|
step |
Number |
<optional> |
1
|
Returns:
- Type
- Array
(inner) array_swap(array, a, b)
- Source:
swaps two array elements
Example
var a = [ 1, 2, 3, 4, 5 ];
array_swap( 1, 3 );
a --> [ 1, 4, 3, 2, 5 ];
Parameters:
Name | Type | Description |
---|---|---|
array |
Array | |
a |
Number | first element index |
b |
Number | second element index |
(inner) array_key_sort(array, keyopt, reverseopt) → {Array}
- Source:
quicksort array
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
key |
Method |
<optional> |
||
reverse |
Bool |
<optional> |
false
|
Returns:
Input array but sorted using quicksort algorithm
- Type
- Array
(inner) array_qsort(array, keyopt, reverseopt) → {Array}
- Source:
quicksort array using Hoare partitioning
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
array |
Array | |||
key |
Method |
<optional> |
||
reverse |
Bool |
<optional> |
false
|
Returns:
Input array but sorted using quicksort algorithm
- Type
- Array