aboutsummaryrefslogtreecommitdiff
path: root/aoc2017-gleam/src/aoc_2017/day_12.gleam
blob: 87747d0877d5b43dea152dad1f8246a021a3591f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import gleam/dict.{type Dict}
import gleam/int
import gleam/list
import gleam/result
import gleam/string

type Pipes =
  Dict(Int, List(Int))

pub fn parse(input: String) -> Pipes {
  {
    use row <- list.map(string.split(input, "\n"))
    let assert Ok(#(from, to)) = string.split_once(row, " <-> ")

    let assert Ok(from) = int.parse(from)
    let to = to |> string.split(", ") |> list.map(int.parse) |> result.values

    #(from, to)
  }
  |> dict.from_list
}

pub fn pt_1(input: Pipes) {
  input
}

pub fn pt_2(input: Pipes) {
  todo as "part 2 not implemented"
}