crow/board/grid

Types

pub type Error {
  NegativeInitialization
  OutOfBounds
  NoContent
}

Constructors

  • NegativeInitialization
  • OutOfBounds
  • NoContent
pub type Grid(content) {
  Grid(limits: Limits, positions: Map(Coordinate, content))
}

Constructors

  • Grid(limits: Limits, positions: Map(Coordinate, content))
pub type Limits {
  Limits(x: Coordinate, y: Coordinate)
}

Constructors

  • Limits(x: Coordinate, y: Coordinate)

Functions

pub fn delete(in grid: Grid(a), at position: Coordinate) -> Grid(
  a,
)
pub fn filter(grid: Grid(a), apply: fn(Coordinate, a) -> Bool) -> Grid(
  a,
)
pub fn in_bounds(in grid: Grid(a), at position: Coordinate) -> Result(
  Coordinate,
  Error,
)
pub fn map(grid: Grid(a), apply: fn(Coordinate, a) -> a) -> Grid(
  a,
)
pub fn new(x: Int, y: Int) -> Result(Grid(a), Error)
pub fn retrieve(in grid: Grid(a), at position: Coordinate) -> Result(
  a,
  Error,
)
pub fn set(in grid: Grid(a), at position: Coordinate, value value: a) -> Result(
  Grid(a),
  Error,
)
pub fn update(in grid: Grid(a), at from: Coordinate, to to: Coordinate) -> Result(
  Grid(a),
  Error,
)
Search Document