curry and compose -- functional language constructs

Ben Wolfson wolfson at uchicago.edu
Wed May 2 09:17:33 CEST 2001


In article <HoNH6.45055$HF.10107141 at news4.rdc1.on.home.com>, "Nick
Perkins" <nperkins7 at home.com> wrote:

> I think these are really cool, but i have never seen anyone use curry or
> compose.  Why not?  Shouldn't everyone use these all the time?

I used a compose() once:

def action_maker(v,r):
   vl=(
        lambda f: None,
        lambda f: sys.stdout.write('removed %s\n' % f)
      )
   rl=(
        lambda f: f,
        lambda f: (os.remove(f),f)[1]
      )
   return compose(vl[v],rl[r])
 
> Does anyone have any other neat Python solutions that provide
> 'functional-style' features?

There are several memoization modules floating around.

-- 
Barnabas T. Rumjuggler
"Et tu, Brute?" sedulous.
 -- barry in indy, in apihna



More information about the Python-list mailing list