Functional programming in Python

Peter Douglass peterd@availant.com
Thu, 24 May 2001 09:07:44 -0400


Peter Hancock wrote:

> >                 foo( bar( baz( x ) ) )
> >         it's:
> >                 (foo ( bar (baz x) ) )
> 
> Clearly the outer parentheses are unnecessary in the last expression.
> One undeniable advantage of (f a) is it saves parentheses.

Yes and no.   In

( ( ( foo bar) baz) x )

the parens can be omitted to leave

      foo bar baz x

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.

--PeterD