For this one, I've started using ARGF, which allows it to receive the argument on stdin or as a filename. So this works the same and is a bit more flexible: ARGF.then { puts product_duals(_1) }. At this point, I suppose, it's a bit difficult to justify the then, but there's 25 of these things, I'm sure the will be plenty of opportunities 😜
Also, thanks for talking about then, and implicit arg references. I had heard about both but not played with them enough to internalize them. I've been doing tap + break, and explicit arguments 😐
For this one, I've started using
ARGF
, which allows it to receive the argument on stdin or as a filename. So this works the same and is a bit more flexible:ARGF.then { puts product_duals(_1) }
. At this point, I suppose, it's a bit difficult to justify thethen
, but there's 25 of these things, I'm sure the will be plenty of opportunities 😜Also, thanks for talking about
then
, and implicit arg references. I had heard about both but not played with them enough to internalize them. I've been doingtap
+break
, and explicit arguments 😐Y'know I always forget about
ARGF
because of how rarely I write CLI type scripts. Admittedly I putthen
in there just to demonstrate that it works.You can even go a step further with
$<.read
or$<.readlines
- I've been doing this in my "golfed" solutions.