osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can one use Python to learn and even apply Functional Programming?


On Sat, Feb 15, 2014 at 8:45 PM, Sam <lightaiyee at gmail.com> wrote:
> I would like to learn and try out functional programming (FP). I love Python and would like to use it to try FP. Some have advised me to use Haskell instead because Python is not a good language for FP. I am sort of confused at the moment. Is Python a dysfunctional programming language to apply FP? Can the more experienced Python users advise?

Everything about FP that can be done in, say, Scheme, can be done in
Python, with the exception of tail recursion (but that isn't important
for "real" FP). But Scheme is old, and people keep thinking of new
things and more interesting variations on the lambda calculus.

Haskell is kind of the core of modern functional programming, and
involves heavy use of concepts that do not exist or are visibly alien
in Python. If you want to learn FP properly, you should learn Haskell.
Otherwise you will likely be confused when you overhear functional
programmers talking, whether it's about Hindley-Milner or sum types or
eta conversion.

-- Devin