News for hackers. Stuff that matters.
Re:Functional Programming With Ruby by stuffihavemade on Tuesday July 26, 2011 @09:13PM (#2810255)
I like Ruby, and I like functional programming, but if you try to shoehorn statelessness into your Ruby programs, you will be fighting the language, and you will feel a lot of pain. All of the data structures are ephermal, even strings. So, the language will not give thet persisitent, relatively perfomant strutuctes that Haskell or Clojure provides. If you want functional Ruby, just go use Clojure.
Re:Functional Programming With Ruby by rlander on Tuesday July 26, 2011 @09:44PM (#2810338)
While I do agree with you that trying to shoehorn ruby into a pure functional style is a bad idea, I believe it's generally a good thing to try to write functional-style ruby: Functional in the small and OO in the large [1].

For example, you can have referential transparency in your methods, which will allow for easier debugging. You can also strive for simpler data structures and even freeze objects to make them immutable[2].

[1] http://www.johndcook.com/blog/2009/03/23/functional-in-the-s... [2] http://ontwik.com/ruby/better-ruby-through-functional-progra...