I had to write my own Num.abs as it crashes the compiler but today was nice and easy: https://github.com/shritesh/advent/blob/main/2021/7.roc
Issue: https://github.com/roc-lang/roc/issues/4210
Day 7 was not too hard, but I spent too much time trying to debug something that need like a single line of printf debugging for me to figure out. Can't wait until #4093 is fixed. Anyway, my code is here: https://github.com/bhansconnect/roc-aoc-2021/blob/trunk/day7/part2.roc
For part1, the solution is not to compute the median?
I didn't read well the instructions :face_palm:
I guess that means it isn't median?
It is, but the result is not the median itself but the sum of all the move
I wrote 3 different algorithms to get the same result and be sure I was dumb at reading the instruction :sweat_smile:
ah. makes sense
Here it is :octopus: https://github.com/ghigt/advent-of-code/blob/main/roc/day-7/part2.roc
Last updated: Jul 06 2025 at 12:14 UTC