Of what use is 'lambda'???

Suchandra Thapa ssthapa at harper.uchicago.edu
Tue Sep 26 03:29:59 EDT 2000


Jonadab the Unsightly One <jonadab at bright.net> wrote:
>I have a question.  What is the difference between functional
>programming and procedural programming?  I know I should know
>this, but...

    Functional programming consists of writing programs using functions
which depend only on their inputs.  E.g. if you have a function foo(x, y)
then calling foo(2, 2) always gives the same return value.  This implies
that foo can't depend on any state information since if foo also depends
on a variable bar then the return value of foo(2, 2) may not be the same as
it was previously if bar changes.  As a rule of thumb, functional languages
don't allow or heavily discourage you from changing the value of a variable 
once you've declared the value to be something.

-- 
------------------------------------------------------------------

Suchandra S. Thapa 
s-thapa at uchicago.edu

------------------------------------------------------------------



More information about the Python-list mailing list