Go v0.2.0 Go.Coordinate

Documentation for Go.Coordinate

To be more compliant with Ecto and JSON, this entity replace old tuple form of coordinate.

It is a simple struct with row and col keys.

Summary

Functions

Returns a new Coordinate structure from a tuple

Returns a list of new Coordinate structures from a list of tuples

Returns a list of new tuples from a list of Coordinate structures

Returns a new Coordinate structure it accepts:

  • a tuple
  • 2 arguments (row, col)

Returns a tuple from Coordinate structure

Types

col()
col() :: integer
row()
row() :: integer
t()
t() :: %Go.Coordinate{col: col, row: row}

Functions

from_tuple(coordinate)
from_tuple({row, col}) :: t

Returns a new Coordinate structure from a tuple

list_from_tuples(coordinates)
list_from_tuples([{row, col}]) :: [t]

Returns a list of new Coordinate structures from a list of tuples

list_to_tuples(coordinates)
list_to_tuples([t]) :: [{row, col}]

Returns a list of new tuples from a list of Coordinate structures

new(coordinate)
new({row, col}) :: t

Returns a new Coordinate structure it accepts:

  • a tuple
  • 2 arguments (row, col)
new(row, col)
new(row, col) :: t
to_tuple(coordinate)
to_tuple(t) :: {row, col}

Returns a tuple from Coordinate structure