diff options
Diffstat (limited to 'aoc2017-gleam/src/aoc_2017/day_12.gleam')
-rw-r--r-- | aoc2017-gleam/src/aoc_2017/day_12.gleam | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/aoc2017-gleam/src/aoc_2017/day_12.gleam b/aoc2017-gleam/src/aoc_2017/day_12.gleam new file mode 100644 index 0000000..87747d0 --- /dev/null +++ b/aoc2017-gleam/src/aoc_2017/day_12.gleam @@ -0,0 +1,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" +} |