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

comments

aylac.top 2f792f59 168d56a0

verified
Changed files
+3 -1
2025
3
gleam
+3 -1
2025/3/gleam/src/main.gleam
···
// and then we get the highest number
// and done here
// little assert because failing is better than the silent failing of unwrap
+
// list.take instead of drop would allow me to do it without reversing two times but like it would also need list.length which also goes through the whole list but without letting me put it in just pipes
+
// i mean i COULD count it once when starting it when then after getting the location subtracting from it but meh already did the rust version and this would put too much stuff on here
let assert Ok(#(max, loc)) =
bank
|> list.reverse
···
// i wasn't using this number trick when i was doing it, i was literally just finding a power of 10 and multiplying it but like the power thing in gleam sucks it's like float only. i now learned this trick from *someone* and will be using it. don't know how i didn't figure out myself. oh wait i do it's because i'm stupid
// but yeah it just multiplies the number by ten so like 4 becomes 40 and then we add our like 3 to it 43 and then 43 to 430 and the 5 you get the gist of it. again don't know how i didn't see it myself
// and then we drop the parts of the list that can't be used for the subsequent numbers. like off by one evil thing in here to not include the number we just used too
-
// wky don't we add 1 to everything in the thing above? because that would be more math than just adding it only once here duh
+
// why don't we add 1 to everything in the thing above? because that would be more math than just adding it only once here duh
#(number * 10 + max, list.drop(bank, loc + 1))
})
// and then like every advent of code we add it to the acc