Created
June 28, 2015 08:19
-
-
Save cr1901/c6d11e084dd8338d80a2 to your computer and use it in GitHub Desktop.
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
#lang racket | |
(define (my_closure x) ;Return a fcn which adds x to its input. | |
(define copy-of-x x) | |
(lambda (y) | |
(set! copy-of-x (+ copy-of-x y)) | |
copy-of-x | |
) | |
) | |
(define copy-of-my-closure (my_closure 4)) | |
((my_closure 4) 5) ;9 | |
((my_closure 4) 5) ;9 | |
(copy-of-my-closure 5) ;9 | |
(copy-of-my-closure 5) ;14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment