Created
March 14, 2016 01:05
-
-
Save clemtibs/1deddb0915bd012d4c0a to your computer and use it in GitHub Desktop.
Infinite currying using tail-recursion in Racket
This file contains 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
#lang racket | |
(define (rec-curry-add [inc 0] [sum 0]) | |
(if (equal? inc 0) | |
sum | |
(begin | |
(set! sum (+ sum inc)) | |
(lambda ([inc 0]) | |
(rec-curry-add inc sum))))) | |
(rec-curry-add) | |
((rec-curry-add 1)) | |
(((rec-curry-add 1)2)) |
Author
clemtibs
commented
Mar 14, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment