recursion looks off
This commit is contained in:
parent
51c9411f58
commit
072cdd695f
|
@ -197,7 +197,6 @@
|
||||||
val-update]
|
val-update]
|
||||||
[(EnvLexicalReference? t)
|
[(EnvLexicalReference? t)
|
||||||
(lambda: ([m : machine] [v : SlotValue])
|
(lambda: ([m : machine] [v : SlotValue])
|
||||||
(printf "Setting env[~a] to ~s\n" (EnvLexicalReference-depth t) v)
|
|
||||||
(env-mutate m (EnvLexicalReference-depth t) v))]))
|
(env-mutate m (EnvLexicalReference-depth t) v))]))
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,10 @@
|
||||||
(unless (equal? actual exp)
|
(unless (equal? actual exp)
|
||||||
(raise-syntax-error #f (format "Expected ~s, got ~s" exp actual)
|
(raise-syntax-error #f (format "Expected ~s, got ~s" exp actual)
|
||||||
#'stx))
|
#'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
|
;; test, and expect an error
|
||||||
(define-syntax (test/exn stx)
|
(define-syntax (test/exn stx)
|
||||||
|
@ -116,6 +119,17 @@
|
||||||
81)
|
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
|
;; Simple application
|
||||||
(test ((lambda (x) x) 42)
|
(test ((lambda (x) x) 42)
|
||||||
42)
|
42)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user