Skip to content

Instantly share code, notes, and snippets.

@tippenein
Created February 25, 2013 04:15
Show Gist options
  • Save tippenein/5027709 to your computer and use it in GitHub Desktop.
Save tippenein/5027709 to your computer and use it in GitHub Desktop.
(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