On Wed, Apr 20, 2011 at 8:03 AM, Stu [email protected] wrote:
Lots of helpful information in this thread. Thank you all for helping me.
Since I am new to functional programming I am slowly experimenting with what
I know and building slowly from there. In the same fashion that object
oriented is no more than the sum of it’s parts I am interested in learning
as much as I can about this paradigm.
In my understanding closures are not that essential for FP - at least
not for storing data. The Wikipedia article sums the core properties
of FP up pretty good IMHO:
“[…] functional programming is a programming paradigm that treats
computation as the evaluation of mathematical functions and avoids
state and mutable data. It emphasizes the application of functions,
in contrast to the imperative programming style, which emphasizes
changes in state.”
Also a frequently seen feature is first class and higher order
I understand the concept of closure. I imagine the best use for it would be
to build one and embed it in another and so one( correct me if I’m wrong)
That entirely depends on the use case. With currying that is
certainly what happens.
I have read and experimented with ruby’s Proc#curry method. There is a
tutorial online which explains haskell’s monads in ruby I plan on grokking
Are there any other facets of functional programming theory I should look at
to take advantage of?
One interesting thing that you can take away from FP is that some
things do get easier even in OO if you avoid side effects. For
example concurrency has less issues if objects are immutable. Of
course the downside is that you pay with GC overhead and frozen
instances in some way go against the paradigm of OO because one of the
major aspects of OO is encapsulation of state with functionality; and
this typically means mutable state. But on the other hand in
certain areas (e.g numbers and arithmetic) the concept of immutable
state is quite common in OO languages (Ruby and Java both have it).
If you really want to dive deeper into FP you should probably not use
Ruby but rather a first class FP language. I won’t recommend one
because others know that area far better than I do. There were some
You can also find a pretty neat list here: