Day 22 โ Solutions
My https://github.com/wevre/advent-of-code/blob/master/src/advent_of_code/2023/day_22_bricks.clj.
Here's https://github.com/alexalemi/advent/blob/main/2023/clojure/p22.clj.
@michaeljweaver did you know that clojure 1.11 has update-keys/update-vals? not sure if that corresponds to your map-vals function exactly, just thought I'd mention it
https://github.com/zelark/AoC/blob/master/src/zelark/aoc_2023/day_22.clj I believe.
I do know of those, @borkdude but I donโt find myself using them often. Maybe Iโm not good at recognizing opportunities to use them.
@michaeljweaver hah, sorry, I misremembered which solution used map-vals, but it was actually @alexalemiโs solution!
but probably this does something slightly different :)
Yeah it looks like it might be a little too complicated for update-vals.
it did prompt me to add update-vals and update-keys to squint though ;)
I had a long drive today and thought about the problem. I added some commentary to my https://github.com/wevre/advent-of-code/blob/master/src/advent_of_code/2023/day_22_bricks.clj (mostly for future me).
Yeah, I frequently forget about update-vals and update-keys, but in this case I have some special logic where I remove the key if its children are empty.