recursion looks off

This commit is contained in:
Danny Yoo 2011-03-08 03:07:46 -05:00
parent 51c9411f58
commit 072cdd695f
2 changed files with 15 additions and 2 deletions

View File

@ -197,7 +197,6 @@
val-update]
[(EnvLexicalReference? t)
(lambda: ([m : machine] [v : SlotValue])
(printf "Setting env[~a] to ~s\n" (EnvLexicalReference-depth t) v)
(env-mutate m (EnvLexicalReference-depth t) v))]))

View File

@ -24,7 +24,10 @@
(unless (equal? actual exp)
(raise-syntax-error #f (format "Expected ~s, got ~s" exp actual)
#'stx))
(printf "ok. ~s steps\n\n" num-steps)))))]))
(unless (= (length (machine-env a-machine)) 1)
(raise-syntax-error #f (format "Stack is not back to the prefix as expected!")
#'stx))
(printf "ok. ~s steps.\n\n" num-steps)))))]))
;; test, and expect an error
(define-syntax (test/exn stx)
@ -116,6 +119,17 @@
81)
;; Slightly crazy expression
(test (begin (define (f x)
(* x x))
(define (g x)
(* x x x))
(- (g (f (+ (g 3)
(f 3))))
1))
2176782335)
;; Simple application
(test ((lambda (x) x) 42)
42)