No matching definitions.

tur/grid

stdlib/grid.tur

typed Grid[A]: 2D row-major grid parameterized over element type A.

Since: Phase TC2-A

defstruct

Grid

(defstruct Grid [A])

parameterized 2D grid with element type A.

Since: Phase TC2

defn

grid-new

(grid-new [width :int height :int])

create a new zero-filled Grid[A].

widthnumber of columns
heightnumber of rows

A new Grid[A] with all elements initialized to 0.

(grid-new 8 8)  ; => 8x8 grid

Since: Phase TC2

defn

grid-get

(grid-get [g :int x :int y :int])

return the element at (x, y).

gGrid[A]
xcolumn index
yrow index

The element of type A at (x, y).

(grid-get g 0 0)  ; => element at (0,0)

Since: Phase TC2

defn

grid-set!

(grid-set! [g :int x :int y :int v :int])

set the element at (x, y).

gGrid[A]
xcolumn index
yrow index
vnew element value of type A
(grid-set! g 0 0 1)

Since: Phase TC2

defn

grid-width

(grid-width [g :int])

return the width of a Grid[A].

gGrid[A]

Width (number of columns).

(grid-width g)  ; => 8

Since: Phase TC2

defn

grid-height

(grid-height [g :int])

return the height of a Grid[A].

gGrid[A]

Height (number of rows).

(grid-height g)  ; => 8

Since: Phase TC2

defn

grid-free

(grid-free [g :int])

free a Grid[A] and its data buffer.

gGrid[A] to free
(grid-free g)

Since: Phase TC2