Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Would (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.



A 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.


"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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: