Simplicity is Complicated
avdi.org
avdi.org
Iterating "by hand" in Ruby is simple in the way a homemade chair is simple. The second example is elegant because it actually takes advantage of the things that differentiate Ruby from Generic Imperative Language X.
"Some people like to wake up really early and use ternary operators. But some people much prefer to sleep in..." versus
"Get up at 5:00, drink your damned coffee and ask people interview questions about pointers or else you're stupid and lazy and you just don't care about your craft."
And then somebody comes along and says "wtf!?! you're the stupid lazy guy who doesn't even program anymore and obviously coffee brewed before 9:00 isn't fresh because the water in the pipes has been sitting there all night."
Now someone has to smash me down saying "Fool! Politeness and boringness are utterly orthogonal" ....
Edit: the code examples were great! by themselves, on a black background, they would have shocked and awed me.
and http://www.infoq.com/interviews/katz-merb
In particular, "It's just a bunch of things in Merb that we don't do. For instance, is like the classic one of Symbol#to_proc, which Rails does. Actually, Rails recently took out a bunch of use of it, because is 10 times slower on Ruby 1.86, so it's just the things that we don't do in Merb that give us a lot of performance right out the box."
Also, why is he calling :to_time there but not in the iterative example?
> If you specify a symbol ... each element will be passed to the named method of _memo_
Also, the `sum = ` part isn't really needed either.
"Fore!"
Not that I'm complaining, mind you, I actually learned something from this comment. Thanks!