The interpreter contains the definitions of the library units extras, srfi-1, srfi-4, srfi-18, srfi-37, format, regex, script-utils and syntax-case. If available, the units posix, chicken-setup and tcp are also included.
Additional macros and procedures available in the interpreter are:
Only the PROC argument is evaluated. Note that multiple pieces of advice on the same procedure are allowed.
>>> (define (fac n)
(if (zero? n) 1 (* n (fac (sub1 n)))))
>>> (define count 0)
>>> (advise fac before (lambda _ (set! count (add1 count))))
>>> (fac 10) ==> 3628800
>>> count ==> 11
>>> (advise fac around
(let ((i 0))
(define (indent)
(do ((i i (sub1 i)))
((zero? i))
(write-char #\space)))
(lambda (f n)
(indent)
(print "fac: " n)
(set! i (add1 i))
(let ((x (f n)))
(set! i (sub1 i))
(indent)
(print "-> " x)
x))))
>>> (fac 3)
fac: 3
fac: 2
fac: 1
fac: 0
-> 1
-> 1
-> 2
-> 6 ==> 6
>>> count ==> 15
>>> (set! count 0)
>>> (unadvise fac)
>>> (fac 10) ==> 3628800
>>> count ==> 0
>>> (fac 10) ==> 3628800 >>> (trace fac) >>> (fac 3) |(fac 3) | (fac 2) | (fac 1) | (fac 0) | fac -> 1 | fac -> 1 | fac -> 2 |fac -> 6 ==> 6 >>> (untrace fac) >>> (fac 3) ==> 6