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

An unsatisfying article. Judging from the code, I am not convinced that the author gets Ruby. At the very least, Proc#curry doesn't make a very compelling example.


I'm sorry you feel that way. What about that example makes you think I don't understand Ruby? Composing functions (and currying in arguments one at a time) is probably one of the more powerful things you can do with the language.

I wasn't saying that is how I would implement filters. Just that that is the DRYest way to do so--and it's easy in Ruby.


You have nothing to be sorry about. If I had noticed that this was a self-post I would have phrased my response more personally and (hopefully) with more tact.

I'm not looking to second guess each of your examples, many of which were fine. I felt that your currying example was trying to bring in a purely functional toolkit ala Lisp when it wasn't appropriate. Function composition (which you allude to in your reply, yet I don't see) and blocks (especially!) show off Ruby's functional capabilities quite well and would be just as effective and more practical.

Btw, if you're quite new to Python, do yourself a favor and learn about list comprehensions. They can be quite wonderful.

Good luck!


Ah okay, I think I see your point. The currying example was intentionally Lisp-inspired. I didn't mention this, but I've also just started to program in Clojure--though not for work.

As I say, I wouldn't use that last technique in my actual code. It just shows how powerful the language actually is. I think my normal code falls in line with the standard Ruby paradigms, but with a functional twist.

And yes, list comprehensions are fantastic. :)




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

Search: