tupelo.array.mutable

Array

Plumatic Schema type definition for a 2-D array of values (a vector of vectors).

array->col-vals

(array->col-vals arr)
Inputs: [arr :- Array]
Returns: tsk/Vec

Returns the concatenation of all array cols.

array->cols

(array->cols arr)(array->cols arr col-idxs)(array->cols arr low high)
Inputs: ([arr] [arr col-idxs :- [s/Int]] [arr :- Array low :- s/Int high :- s/Int])
Returns: [[s/Any]]

Usage:
   (array->cols arr)           Returns all array cols
   (array->cols arr col-idxs)  Returns array cols specified by col-idxs
   (array->cols arr low high)  Returns array cols in half-open interval [low..high) 

array->edn-rows

(array->edn-rows arr)
Inputs: [arr :- Array]
Returns: [[s/Any]]

Returns a persistant EDN data structure (vector-of-vectors) from the array.

array->row-vals

(array->row-vals arr)
Inputs: [arr :- Array]
Returns: tsk/Vec

Returns the concatenation of all array rows.

array->rows

(array->rows arr)(array->rows arr row-idxs)(array->rows arr low high)
Inputs: ([arr] [arr row-idxs :- [s/Int]] [arr :- Array low :- s/Int high :- s/Int])
Returns: [[s/Any]]

Usage:
   (array->rows arr)           Returns all array rows
   (array->rows arr row-idxs)  Returns array rows specified by row-idxs
   (array->rows arr low high)  Returns array rows in half-open interval [low..high) 

array->str

(array->str arr)
Inputs: [arr :- Array]
Returns: s/Str

Returns a string representation of an array

col-drop

(col-drop orig & idxs-drop)
Inputs: [orig :- Array & idxs-drop :- [s/Int]]
Returns: Array

Drop one or more cols from an array

col-get

(col-get arr jj)
Inputs: [arr :- Array jj :- s/Int]
Returns: tsk/Vec

Gets an Array col

col-set

(col-set arr jj new-col)
Inputs: [arr :- Array jj :- s/Int new-col :- tsk/Vec]
Returns: Array

Sets an Array col

col-vals->array

(col-vals->array nrows ncols col-data)
Inputs: [nrows :- s/Int ncols :- s/Int col-data :- tsk/Vec]
Returns: Array

Return a new Array of size=[nrows ncols] with its columns constructed from from col-data.

cols-append

(cols-append arr & cols)
Inputs: [arr :- Array & cols :- [tsk/Vec]]
Returns: Array

Appends one or more cols onto an array. Returns a new array.

edn-cols->array

(edn-cols->array col-vecs)
Inputs: [col-vecs :- [[s/Any]]]
Returns: Array

[col-vecs]
Return a new Array initialized from col-vecs. Cols must all have same length.

edn-rows->array

(edn-rows->array row-vecs)
Inputs: [row-vecs :- [[s/Any]]]
Returns: Array

Return a new Array initialized from row-vecs. Rows must all have same length.

elem-get

(elem-get arr ii jj)
Inputs: [arr :- Array ii :- s/Int jj :- s/Int]
Returns: s/Any

Gets an Array element

elem-set

(elem-set arr ii jj newVal)
Inputs: [arr :- Array ii :- s/Int jj :- s/Int newVal :- s/Any]
Returns: Array

Puts a value into an Array element, returning the updated Array.

equals

(equals x y)
Inputs: [x :- Array y :- Array]
Returns: s/Bool

Returns true if two arrays contain equal data

flip-lr

(flip-lr orig)
Inputs: [orig :- Array]
Returns: Array

Flips an array in the left-right direction,
reversing the order of the cols of an array. Returns a new array.

flip-ud

(flip-ud orig)
Inputs: [orig :- Array]
Returns: Array

Flips an array in the up-down direction,
reversing the order of the rows of an array. Returns a new array.

glue-horiz

(glue-horiz & arrays)
Inputs: [& arrays :- [Array]]
Returns: Array

Concatenates 2 or more arrays horizontally. All arrays must have the same number of rows. Returns a new array.

glue-vert

(glue-vert & arrays)
Inputs: [& arrays :- [Array]]
Returns: Array

Concatenates 2 or more arrays vertically. All arrays must have the same number of cols. Returns a new array.

new

(new nrows ncols)(new nrows ncols init-val)
Inputs: ([nrows :- s/Int ncols :- s/Int] [nrows :- s/Int ncols :- s/Int init-val :- s/Any])
Returns: Array

Return a new Array of size=[nrows ncols], initialized to `init-val` (default=nil)

num-cols

(num-cols arr)
Inputs: [arr :- Array]
Returns: s/Int

Returns the number of cols of an Array.

num-rows

(num-rows arr)
Inputs: [arr :- Array]
Returns: s/Int

Returns the number of rows of an Array.

rotate-left

(rotate-left orig)
Inputs: [orig :- Array]
Returns: Array

Rotates an array 90 deg counter-clockwise. Returns a new array.

rotate-right

(rotate-right orig)
Inputs: [orig :- Array]
Returns: Array

Rotates an array 90 deg counter-clockwise. Returns a new array.

row-drop

(row-drop orig & idxs-drop)
Inputs: [orig :- Array & idxs-drop :- [s/Int]]
Returns: Array

Drop one or more rows from an array

row-get

(row-get arr ii)
Inputs: [arr :- Array ii :- s/Int]
Returns: tsk/Vec

Gets an Array row

row-set

(row-set arr ii new-row)
Inputs: [arr :- Array ii :- s/Int new-row :- tsk/Vec]
Returns: Array

Sets an Array row

row-vals->array

(row-vals->array nrows ncols row-data)
Inputs: [nrows :- s/Int ncols :- s/Int row-data :- tsk/Vec]
Returns: Array

Return a new Array of size=[nrows ncols] with its rows constructed from from row-data.

rows-append

(rows-append arr & rows)
Inputs: [arr :- Array & rows :- [tsk/Vec]]
Returns: Array

Appends one or more rows onto an array. Returns a new array.

symmetric?

(symmetric? arr)
Inputs: [arr :- Array]
Returns: s/Bool

Returns true iff an array is symmetric

transpose

(transpose orig)
Inputs: [orig :- Array]
Returns: Array

Returns the transpose of an array. Returns a new array.