Functional programming

Rustom Mody rustompmody at gmail.com
Mon Mar 3 12:45:48 CET 2014


On Monday, March 3, 2014 6:57:15 AM UTC+5:30, Ned Batchelder wrote:
> On 3/2/14 6:14 PM, musicdenotation wrote:
> > If Python is not a fnctional language, then which programming paradigmis dominant?

> is_a_functional_language() is not a binary condition, yes or no.  It's a 
> continuum.  Python has more functional constructs than Pascal, and fewer 
> than Haskell.

I find this the most agreeable answer. I would add:

There are really two continuaa:
the 'CAN' and the 'CANNOT' (sounds 180 deg apart but they are actually
rather independent)

As Ned says on the CAN spectrum python sits between standard
imperative languages like C,Pascal and Haskell, in fact coming quite close
to Haskell.

However it is also useful to consider the CANNOT spectrum for
beginners/pedagogical purposes.

If you start a beginner on a language like Haskell which CANNOT:
- express iteration except with recursion
- cannot have assignments (and therefore anything remotely like a normal
program variable; variables are only ever math variables)
- cannot do a 'type-incorrect' expression like
>>> [1,2] + [[3,4],[5]]
[1, 2, [3, 4], [5]]

the beginner will develop a significantly different mind-set than
starting from a python-like language




More information about the Python-list mailing list