Created
February 25, 2013 04:15
-
-
Save tippenein/5027709 to your computer and use it in GitHub Desktop.
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
(define-syntax while-less | |
(syntax-rules (do) | |
[(while-less e1 do e2) | |
(if (< e1 e2) | |
#t | |
e2)])) | |
;; this is obviously wrong, but I'm not sure how to eval e2 until (< e1 e2) | |
(define a 2) | |
(while-less 7 do (begin (set! a (+ a 1)) (print "x") a)) | |
;; should print x x x x x and set a=7 | |
(print a) | |
(while-less 7 do (begin (set! a (+ a 1)) (print "x") a)) | |
;; should print x and set a=8 | |
(print a) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment