added more examples about traces in libtrace.ss

This commit is contained in:
Abdulaziz Ghuloum 2006-12-05 13:56:54 -05:00
parent d9915f371b
commit bbf0936963
2 changed files with 14 additions and 0 deletions

Binary file not shown.

View File

@ -105,3 +105,17 @@ Try:
[else (fact (sub1 n) (* n m))]))
(fact 5 1)
(trace-define (fact n m k)
(cond
[(zero? n) (k m)]
[else (begin (fact (sub1 n) (* n m) k) 0)]))
(call/cc
(lambda (k)
(fact 6 1
(trace-lambda escape (v) (k v)))))
(trace-define (infinite-loop n)
(infinite-loop (add1 n)))
(infinite-loop 0)