diff options
Diffstat (limited to 'aoc-2020-gleam/src/util/pos2.gleam')
-rw-r--r-- | aoc-2020-gleam/src/util/pos2.gleam | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/aoc-2020-gleam/src/util/pos2.gleam b/aoc-2020-gleam/src/util/pos2.gleam index 0b6256c..3f478ac 100644 --- a/aoc-2020-gleam/src/util/pos2.gleam +++ b/aoc-2020-gleam/src/util/pos2.gleam @@ -8,6 +8,14 @@ pub type Pos2 = pub const zero = #(0, 0) +pub fn x(pos: Pos2) -> Int { + pos.0 +} + +pub fn y(pos: Pos2) -> Int { + pos.1 +} + pub fn directions8() -> Set(Pos2) { set.from_list({ use x <- list.flat_map(over: [-1, 0, 1]) |