Now Advent of Code 2019 is live and the first challenge is out. I didn't really do it last year, though I did flip through a couple of the questions. And I solved one of them in Vim, because that's the kind of fool I am.
I wanted to post, in a slightly excited manner, about my experience so far this year. I've made a private leaderboard for friends at my office, and we're going to see how we all get along, and chat over Slack and coffee, that sort of thing. So it's a team-community-building phenomenon, I guess.
But what I wanted to talk about really, is how this has woken me up this morning. Where I am, it's 7:30 (or it was when I started typing) and I've had half a coffee.
I decided to do the first challenge in Python.
I had to Google things.
Well, DuckDuckGo them, at any rate.
I learned stuff.
My first thought with this challenge (it's a take on the rocket equation but pared down to a few operations list of integers) was to use
reduce until I found out...
reduce isn't part of core Python anymore. Yeah, that's how out of date I am. It's still there, in
functools but you have to explicitly import it. Why is that?
map is still there.
It's because of the old Benevolent Dictator:
So now reduce(). This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly.
reduce and part of me's trained itself to think that's just the way things are done now.
It reminds me that the Zen of Python exists.
Simple is better than complex.
This is a good Christmas present.