looks clever, but is also sort of hard to read/understand. Even if you're fluent in the syntax and functionality involved it has a higher cognitive load than
RANKS = %w(2 3 4 5 6 7 8 9 10 J Q K A).freeze
which I think does the same thing, but also has the benefit of less typing.
Whenever I see something complicated looking that just does something simple, I spend a lot of time wondering what it is I missed. Am I missing something here?
Not really, most of the point of these posts is not always to be 100% clear as much as be a ride through a lot of new features to explore and think about. If I were writing this as production code it'd look a fair bit different, but that might be a followup article as well.
Most of the reason for that is that it's quicker to type in a REPL when I'm testing things.
looks clever, but is also sort of hard to read/understand. Even if you're fluent in the syntax and functionality involved it has a higher cognitive load than
which I think does the same thing, but also has the benefit of less typing.
Whenever I see something complicated looking that just does something simple, I spend a lot of time wondering what it is I missed. Am I missing something here?
Not really, most of the point of these posts is not always to be 100% clear as much as be a ride through a lot of new features to explore and think about. If I were writing this as production code it'd look a fair bit different, but that might be a followup article as well.
Most of the reason for that is that it's quicker to type in a REPL when I'm testing things.
That makes sense, thanks.