Created
September 4, 2011 22:05
-
-
Save Djexus/1193591 to your computer and use it in GitHub Desktop.
Currying syntax 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-syntax lambda-curried | |
(syntax-rules () | |
((_ (a ...) b ...) | |
(letrec | |
((curry (lambda (func . passed-args) | |
(if (>= (length passed-args) (length '(a ...))) | |
(apply func passed-args) | |
(lambda new-args | |
(apply curry (cons func (append passed-args new-args)))))))) | |
(curry (lambda (a ...) b ...)))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment