Currying a function n times in Scheme
- by user1724421
I'm having trouble figuring out a way to curry a function a specified number of times. That is, I give the function a natural number n and a function fun, and it curries the function n times. For example:
(curry n fun)
Is the function and a possible application would be:
(((((curry 4 +) 1) 2) 3) 4)
Which would produce 10.
I'm really not sure how to implement it properly. Could someone please give me a hand? Thanks :)