functional programming with map()
sdm7g at virginia.edu
Mon Feb 25 21:02:30 CET 2002
> >>I'd prefer
> >>[x.f() for x in items]
> >>It's not functional syntax, but so what?
> > Sure it is.
On Mon, 25 Feb 2002, Grant Edwards wrote:
> Methinks there are two definitions of "functional" at work here:
> 1) The traditional CS "no side-effects" definition.
> 2) Something that looks like a function call.
"Functional Programming" is a programming style that uses functions
as first class objects, favors declarative over procedural, and avoids
"Functional Programming Languages" are languages that support that
style of programming.
"Pure Functional Programming Languages" are languages that support
that style of programming and try to prevent you from programming
in any other style.
It's not so much two definitions as it is a disagreement over whether
"functional" is a binary or an analog adjective. It's the same issue as
with "object oriented": i.e. can Python be considered an Object Oriented
Language if it's missing one of the "required" features ( like
encapsulation, for example) ?
For both Functional and O-O programming, the style evolved first, then
came better language support, and last came the academic purifiers.
List comprehensions are declarative (no loops) and they avoid side effects
(no loop variables or temporaries) -- plus they were originally used
in a pure functional language (Haskell) -- sounds like functional
syntax to me!
-- Steve Majewski
More information about the Python-list