my solutions to advent of code
aoc advent-of-code

ok yeah i thought it might make it worse because idk how expensive deletion is but nope it is a bit faster

aylac.top 05ba45c0 7e73817e

verified
Changed files
+8 -2
2015
6
gleam
+8 -2
2015/6/gleam/src/main.gleam
···
TurnOff -> False
TurnOn -> True
}
-
grid |> dict.insert(loc, value)
+
case value {
+
False -> grid |> dict.delete(loc)
+
True -> grid |> dict.insert(loc, value)
+
}
})
})
}
···
TurnOff -> int.max(0, cur - 1)
TurnOn -> int.max(0, cur + 1)
}
-
grid |> dict.insert(loc, value)
+
case value > 0 {
+
False -> grid |> dict.delete(loc)
+
True -> grid |> dict.insert(loc, value)
+
}
})
})
}