Me: Readability, simplicity, KISS πŸ‘ Also me: Could be done in one pass, I am suffering 😬 Me: Not even measurable motherfucker πŸ‘ Also me: Could be done in one pass, I am suffering 😬

6:54 PM Β· Jan 9, 2021

3
0
22
Mind you, that is an #AdventOfCode exercise, not even production code. πŸ˜‚ I’ll leave the KISS version, and call it a day. However, I don’t promise I won’t think about that loop in my death bed.
0
0
3
Replying to @fxn
Instead of map + map you can use map_of which is less typing and it's actually more efficient
2
0
2
I meant map + max
0
0
0
So, thanks to this semi-joke, I learned from @asterite that `Enumerable` has `max_of` in Crystal. So this one is more concise, even shorter, and more performant: It does not build an intermediary array, and does everything in one pass. As you'd do it by hand. πŸ’ͺ
0
0
8