Two-dimensional matrix backed by Array from the Elm core, the fast immutable array implementation.
Return an empty matrix.
size empty == ( 0, 0 )Initialize a matrix, given desired size and a function for the value of a cell, given its x and y.
Matrix.initialize 100 100 (\x y -> String.fromInt x ++ "," ++ String.fromInt y)Initialize a matrix, given desired size and the value for every cell.
Matrix.repeat 100 100 InitialValueReturn the size of a matrix in the form of a tuple, (sizeX, sizeY).
Maybe get the value of the cell at (x,y).
Get all values along a given x as an array. If x is out of bounds, return an empty array.
Get all values along a given y as an array. If y is out of bounds, return an empty array.
Return an array of possible neighbour cells for a given cell. It is an array of Maybe, compare the get function that is a single Maybe.
Set the cell at (x,y) to a new value. If the (x,y) is out of bounds, silently do nothing,
Apply a function on every element in a matrix.
Matrix.map (\\n -> n \* 2) [ [ 0, 0, 0 ], [ 0, 1, 2 ] ] => [ [ 0, 0, 0 ], [ 0, 2, 4 ] ]Apply a function on every element with its x and y as first arguments.
Matrix.indexedMap (\\x y \_ -> (String.fromInt x + "," + String.fromInt y)(Matrix.repeat 2 3 "")
=> [[ "0,0", "0,1", "0,2" ],[ "1,0", "1,1", "1,2" ] ]
Representation of immutable, two dimensional matrix. You can create a matrix of integers (
Matrix Int) or strings (Matrix String) or any other type of value you can dream up.