Functional programming in Python

Tom Pledger Tom.Pledger@peace.com
Fri, 25 May 2001 09:06:18 +1200


Peter Douglass writes:
 :
 | but in ( foo ( bar (baz x) ) )
 | 
 | You would want the following I think.
 | 
 |      foo . bar . baz x
 | 
 | which does have the parens omitted, but requires the composition
 | operator.

Almost.  To preserve the meaning, the composition syntax would need to
be

    (foo . bar . baz) x

or

    foo . bar . baz $ x

or something along those lines.  I favour the one with parens around
the dotty part, and tend to use $ only when a closing paren is
threatening to disappear over the horizon.

    do ...
       return $ case ... of
           ... -- many lines

Regards,
Tom