looking at tail behavior.
This commit is contained in:
parent
2b56c90c2c
commit
67e91a7212
|
@ -31,5 +31,6 @@
|
|||
|
||||
(provide lookup-primitive)
|
||||
(define lookup-primitive (make-lookup #:functions (+ - * / = < <= > >= cons list car cdr
|
||||
sub1
|
||||
display newline displayln)
|
||||
#:constants (null pi e)))
|
||||
|
|
|
@ -54,7 +54,9 @@
|
|||
[steps 0])
|
||||
(when debug?
|
||||
(when (can-step? m)
|
||||
(printf "~s\n" (current-instruction m))))
|
||||
(printf "env-depth=~s instruction=~s\n"
|
||||
(length (machine-env m))
|
||||
(current-instruction m))))
|
||||
(cond
|
||||
[(can-step? m)
|
||||
(loop (step m) (add1 steps))]
|
||||
|
@ -158,25 +160,25 @@
|
|||
(test (begin (define (f x)
|
||||
(if (= x 0)
|
||||
1
|
||||
(* f (sub1 x))))
|
||||
(* x (f (sub1 x)))))
|
||||
(f 0))
|
||||
1)
|
||||
(test (begin (define (f x)
|
||||
(if (= x 0)
|
||||
1
|
||||
(* f (sub1 x))))
|
||||
(* x (f (sub1 x)))))
|
||||
(f 1))
|
||||
1)
|
||||
(test (begin (define (f x)
|
||||
(if (= x 0)
|
||||
1
|
||||
(* f (sub1 x))))
|
||||
(* x (f (sub1 x)))))
|
||||
(f 2))
|
||||
2)
|
||||
(test (begin (define (f x)
|
||||
(if (= x 0)
|
||||
1
|
||||
(* f (sub1 x))))
|
||||
(* x (f (sub1 x)))))
|
||||
(f 3))
|
||||
6)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user