

Why Functional Programming? - raganwald
http://hamletdarcy.blogspot.com/2008/07/why-functional-programming.html

======
aggieben
I don't grok OCaml at all, since I've never even laid eyes on it, but I
identified with his personal story of moving from one mind-warp to the next as
he matured as a developer. I've now hit the OMG! Functional Programming! stage
myself, which leads to an uncomfortable (some days actually painful) cognitive
dissonance while I toil away for 8 hours a day writing VxWorks-based C code
for a mega-corporation.

~~~
pavelludiq
I never really went through any stages, i just started using python and suing
functions seemed better for some reason than using classes. Now im learning
scheme and i am sort of starting to get it.

~~~
schtog
For me it was the same.

Python offers it all, functional, procedural, object-oriented. So you just
choose hwta fits the problem best and dont worry about politics.

Personally while learning Python I was also learning functional languages and
I started to naturally drift towards a more functional style.

My functional code is just much more modular and natural than my OO-code.

Classes I to represent some data every now and then but it is not central to
my designs.

~~~
raganwald
"Python offers it all, functional, procedural, object-oriented. So you just
choose hwta fits the problem best and dont worry about politics."

I find the idea that Python offers it all surprising, for example my
understanding is that anonymous functions can only be one line and you cannot
write generic functions a'la CLOS.

If that is the case, while Python may offer a terrific language for Getting
Stuff Done, you may want to consider learning other languages on the off
chance that they actually do more in each of their respective areas. Then,
when you return to Python you can apply what you've learned.

~~~
schtog
Yes that is true and I know a lot of languages and while Python perhaps doesnt
offer as deep possibilities within each paradigm it offers every paradigm.

As you said this makes it very good for writing programs and does so in a lot
of different domains but perhaps when digging really deep into one area you
can find something better suited.

------
IsaacSchlueter
I'm not familiar with OCaml, so maybe I'm missing something.

But why does no one gush over Erlang and Javascript when the FP hat gets
passed around? Is OCaml really much better than either of these?

(Javascript, granted, has no shortage of warts. But it's the browser language
we have, so it's worth learning to love it.)

~~~
jon_dahl
Without being an expert, I'm pretty sure that OCaml is more strictly
functional than Erlang and Javascript, though they all support functional
programming to one extent or another. With languages like Javascript and Ruby,
you can program for years without really learning functional concepts. I think
OCaml is the opposite; the paradigm of least resistance is functional, even
though you can program in other styles (OO, imperative).

In terms of functional purity, Haskell > Lisp/Scheme/OCaml/ML > Erlang >
Ruby/Javascript > Python > Java > etc.

~~~
lg
I'd say Erlang enforces functional style more than Lisp does... there's no
Erlang object system.

~~~
IsaacSchlueter
True, it is virtually impossible to do much of anything in Erlang without
using a bunch of little functions. Immutability is a harsh mistress, but one
that I've already fallen in love with.

------
edb
"proclaiming the death of patterns due to closures and dynamic typing."

Can somebody explain that?

