diff options
author | H.J <thechairman@thechairman.info> | 2024-06-14 17:14:05 -0400 |
---|---|---|
committer | H.J <thechairman@thechairman.info> | 2024-06-14 17:14:05 -0400 |
commit | 29d7ae5048297a754b157a45ad65e7bbc18dc977 (patch) | |
tree | 8dfedba7ea6d32743d6b662e31ada52a37f602b4 /aoc2017-gleam/src/aoc_2017/day_12.gleam | |
parent | b338ab2601f7fb10a3500a0bf8e5ba53c1f228e9 (diff) | |
download | gleam_aoc-29d7ae5048297a754b157a45ad65e7bbc18dc977.tar.gz gleam_aoc-29d7ae5048297a754b157a45ad65e7bbc18dc977.zip |
gleam 2017 day 12 started
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" +} |