Skip to content

Instantly share code, notes, and snippets.

@Djexus
Created September 4, 2011 22:05
Show Gist options
  • Save Djexus/1193591 to your computer and use it in GitHub Desktop.
Save Djexus/1193591 to your computer and use it in GitHub Desktop.
Currying syntax in Scheme
(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