Skip to content

Instantly share code, notes, and snippets.

@wecing
Created October 17, 2012 01:56
Show Gist options
  • Save wecing/3903293 to your computer and use it in GitHub Desktop.
Save wecing/3903293 to your computer and use it in GitHub Desktop.
Hmm...
#lang racket
;; recur-1, I guess maybe the problem could be avoided
;; by implementing call carefully?
(fun "recur-1" "x"
(ifgreater (var "x") (int 1)
(add (call (var "recur-1")
(add (var "x")
(int -1)))
(var "x"))
(int 1)))
;; recur-2, this one is more confusing but you cannot
;; make it run correctly with just modifying call...
(mlet "m" (int 5)
(mlet "recur-2"
(fun #f "blah"
(ifgreater (var "m") (int 1)
(add (mlet "m" (add (var "m") (int -1))
(call (var "recur-1") (var "m")))
(var "m")))))
(call (var "recur-2")
(var "m")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment