Functional Programming (was: Of what use is 'lambda'???)
Delaney, Timothy
tdelaney at avaya.com
Sun Sep 24 21:52:29 EDT 2000
The difference is that in *pure* functional programming, everything *only*
returns a parameter. There are no side effects of any kind.
Obviously, pure functional programming is not much use ... so functional
languages usually have a few functions which do have side effects (for
example, i/o routines). However, if you treat these as black boxes, you can
do your programming entirely functionally.
So, this means you can't have a function such as (pseudocode)
function add (a, b)
temp = a + b
// side effect
a = 4
return temp
a = 1
b = 2
c = add(a, b)
Results:
a == 4
b == 2
c == 3
If you wanted to modify a you would have to assign it directly or call a
function and assign the result to a.
> -----Original Message-----
> From: jonadab at bright.net [mailto:jonadab at bright.net]
> Sent: Monday, 25 September 2000 12:38 PM
> To: python-list at python.org
> Subject: Re: Of what use is 'lambda'???
>
>
> Erik Max Francis <max at alcyone.com> wrote:
>
> > > I have a question. What is the difference between functional
> > > programming and procedural programming? I know I should know
> > > this, but...
> >
> > To start with, in functional programming everything returns a value.
>
> That's true in C and Inform, but I think both are traditionally
> regarded as procedural. Is the difference that the returned
> value is always significant? Or is there more?
>
> - jonadab
> --
> http://www.python.org/mailman/listinfo/python-list
>
More information about the Python-list
mailing list