Created
December 15, 2015 02:51
-
-
Save crowl/e0653edc6e52a810ad7e 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
(define once | |
(let ((called #f)) | |
(lambda (f) | |
(lambda args | |
(cond | |
((not called) | |
(set! called #t) | |
(apply f args)) | |
(else args)))))) | |
(define p (once (lambda (x) (* x x)))) | |
(print (p 7)) | |
(print (p 8)) | |
(print (p 9)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment