3 ms·
I'm not a ruby programmer and it's not immediately obvious what the result would be. I know a pretty large number of languages to the point where, unless it's
by wvenable 19y ago
I'm not a ruby programmer and it's not immediately obvious what the result would be.
I know a pretty large number of languages to the point where, unless it's LISP, I can look at code in any language and have some idea of what it does. When a languages gets "so cool" that it's cryptic than I no longer see the benefit.
- raganwald 19y agoWould (1..100).fold(&:+) be more obvious? How about (1..100).reduce(&:+)? If either one of those makes sense, perhaps it is a question of Matz choosing Smalltalk's names for methods (collect, select, detect, reject, inject). Please let me know if changing the name of the method doesn't help.
- spydez 19y agoA little explanation in your article would've been fine. The non-ruby people in the crowd have no clue what "&:+" does, so you lost us really early on when you neglected to explain your fancy one-liner. 'inject' makes sense (in retrospect), but until it was explained, I had no clue why injecting symbol soup into a range of integers was interesting.
- raganwald 19y ago"I had no clue why injecting symbol soup into a range of integers was interesting." Lisp flavours? "A little explanation in your article would've been fine." Done, thank you.