[Tutor] function that returns a fn
bagchee at cse.ohio-state.edu
Sat Dec 11 17:32:43 CET 2004
I'm looking for resources to help me with a fn that returns a fn after
binding one of its arguments (aka currying, like the bind1st of C++)
Considering Python syntax is quite straightforward, this is my first try:
# use opname, eg ops=getlist(opname)
# or set local fn variable
#?or f=listrender(); return f;
Is it really as simple as this? Or will I always return the same function
definition? I need it to return a 'new' function for each call to
getjlistrender() .. do I need to create a new fn with f=listrender() ?
Any pointers to pages/books etc. appreciated. I am looking through my
books too, but thought I'd get some more pointers as well. Web searching
so far only shows lambda, which is one-liner, and that won't do.
We need a language that lets us scribble and smudge and smear, not a language
where you have to sit with a teacup of types balanced on your knee and make
polite conversation with a strict old aunt of a compiler.
-- Paul Graham
More information about the Tutor