Self-currying functions

Carl Banks imbosol at aerojockey.com
Wed May 21 04:06:46 EDT 2003


Dave Benjamin wrote:
> The above nested lambda expression is what curried() creates and then
> eval's. I'd like to do this without the need for an eval, but I am having
> trouble building a for-loop to accomplish this.


Ah, there you go.  You're thinking iteratively when you should be
thinking recursively.

What I did in my solution was to simply look at it this way: you want
to return a function that checks the number of args.  If there are
enough, call it; otherwise, curry the function, and then recursively
call the self-curry-maker on the curried function.


-- 
CARL BANKS




More information about the Python-list mailing list