On Sat, 2011-01-08 at 13:43 +0000, Kevin Wright wrote: [ . . . ] > > The demand for less buggy software is also *always* present, and a > functional style just leads to more inherently testable code - so it's > basically a Good Thing™ even if concurrency wasn't important to you. > > I also object to the idea that a list comprehension (for example) is > more complex than an imperative loop, let alone a whole order of > magnitude more complex! It's simply a different way to thing about > it. If anything, using a declarative approach will help to simplify > things, "pure" SQL vs cursors is an example of this simplification.
In my Python and Groovy courses I have stopped talking about
"functional" and "imperative" approaches, as I find it just creates
conflict. Instead I talk about "action-oriented" and "data-oriented"
approaches. Compare and contrast:
x = [ ]
for i in source :
x.append ( f ( i ) )
x = [ f ( i ) for i in source ]
Even the most hardened "imperative is everything, functional is academic
for wimps" people end up using list comprehensions by choice simply
because it is presented as the imperative, data-driven way.
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
