Created
April 10, 2015 02:35
-
-
Save brenns10/8b7c043eb6edd906e081 to your computer and use it in GitHub Desktop.
Curry a function in Scheme
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define curryn | |
(lambda (func n) | |
(((lambda (f) (f f)) | |
(lambda (f) | |
(lambda (function remaining args) | |
(if (zero? remaining) | |
(apply function args) | |
(lambda (v) | |
((f f) function (- remaining 1) (cons v args))))))) | |
func n '()))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment