diff options
author | J.J <thechairman@thechairman.info> | 2023-12-22 22:51:52 -0500 |
---|---|---|
committer | J.J <thechairman@thechairman.info> | 2023-12-22 22:51:52 -0500 |
commit | 3c5144c6120e27c2013dc95ae8aeebd84103296e (patch) | |
tree | 719f4a646d94f32e3535d3a64161b909078b2e7d /aoc2023/src/day22/solve.gleam | |
parent | d739c6223d29de72a2d1fab4ac9fb34603414f6b (diff) | |
download | gleam_aoc-3c5144c6120e27c2013dc95ae8aeebd84103296e.tar.gz gleam_aoc-3c5144c6120e27c2013dc95ae8aeebd84103296e.zip |
day 22 gleam complete
Diffstat (limited to 'aoc2023/src/day22/solve.gleam')
-rw-r--r-- | aoc2023/src/day22/solve.gleam | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/aoc2023/src/day22/solve.gleam b/aoc2023/src/day22/solve.gleam index b1c360f..7bf2fb4 100644 --- a/aoc2023/src/day22/solve.gleam +++ b/aoc2023/src/day22/solve.gleam @@ -134,9 +134,7 @@ pub fn part1(input: String) { let vulnerable_blocks = vulnerable_blocks(below_blocks) - list.length(dict.keys(block_positions)) - - list.length(vulnerable_blocks) - |> string.inspect + list.length(dict.keys(block_positions)) - list.length(vulnerable_blocks) } fn all_falling_blocks(n: Int, above: BlockTree, below: BlockTree) { @@ -181,9 +179,8 @@ pub fn part2(input: String) { let vulnerable_blocks = vulnerable_blocks(below_blocks) - list.map(vulnerable_blocks, all_falling_blocks(_, above_blocks, below_blocks)) - |> int.sum - |> string.inspect + use acc, b <- list.fold(vulnerable_blocks, 0) + acc + all_falling_blocks(b, above_blocks, below_blocks) } pub fn main() { |