Skip to content

Instantly share code, notes, and snippets.

@brenns10
Created April 10, 2015 02:35
Show Gist options
  • Save brenns10/8b7c043eb6edd906e081 to your computer and use it in GitHub Desktop.
Save brenns10/8b7c043eb6edd906e081 to your computer and use it in GitHub Desktop.
Curry a function in Scheme
(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