Petite Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.

> x
Exception: variable x is not bound
> (define x 6)
> (+ (/ 11 x) (/ 5 7))
107/42
> (define y "This is a string")
> #\x
#\x
> (define z 'x)
> (number? x)
#t
> (symbol? x)
#f
> (symbol? z)
#t
> z
x
> (symbol? y)
#f
> (string? y)
#t
> (zero? x)
#f
> (positive? x)
#t
> (define a (list 2 3 4))
> a
(2 3 4)
> (define c a)
> (define b '(1 2 3))
> (define b '(2 3 4))
> (equal? a b)
#t
> (eq? a b)
#f
> (Max 4 8 3 7)
Exception: variable Max is not bound
> (max 4 8 3 7)
8
> (+)
0
> +
#<procedure +>
> (define / *)
> (/ 4 7)
28
> (= 2 5)
#f
> (= (2) (5))
Exception: attempt to apply non-procedure 5
> (define r (+ 3 5))
> r
8
> (define s '(+ 3 5))
> s
(+ 3 5)
> (eval s)
8
> (if 5 6 7)
6
> a
(2 3 4)
> (define c (cons 1 a))
> (define d (cons 1 a))
> d
(1 2 3 4)
> a
(2 3 4)
> (car a)
2
> (cdr a)
(3 4)
> (car (cdr a))
3
> (cadr a)
3
> (cddr a)
(4)
> (cdddr a)
()
> (cddddr a)
Exception in cddddr: incorrect list structure (2 3 4)
> (cdddddr a)
Exception: variable cdddddr is not bound
> (define times3
  (lambda (n)
    (* n 3)))
> (times3 7)
21
> (define times6
  (lambda (m)
    (+ (times3 m) (times3 m))))
> (times6 7)
42
> (trace times3 times6)
(times3 times6)
> (times6 7)
|(times6 7)
| (times3 7)
| 21
| (times3 7)
| 21
|42
42
> (define fact
  (lambda (n)
    (if (zero? n)
	1
	(* n (fact (- n 1))))))
> (fact 6)
720
> (trace fact)
(fact)
> (fact 6)
|(fact 6)
| (fact 5)
| |(fact 4)
| | (fact 3)
| | |(fact 2)
| | | (fact 1)
| | | |(fact 0)
| | | |1
| | | 1
| | |2
| | 6
| |24
| 120
|720
720
> (define nth-element
  (lambda (ls n)
    (If (null? ls0
	       "error"
	       (if (zero? n)
		   (car ls)
		   (nth-element (cdr ls) (- n 1)))))))
> (nth-element '(a b c d e f) 4)
Exception: variable ls0 is not bound
> (define nth-element
  (lambda (ls n)
    (If (null? ls)
	       "error"
	       (if (zero? n)
		   (car ls)
		   (nth-element (cdr ls) (- n 1))))))
> (nth-element '(a b c d e f) 4)
  (lambda (n)
    (* n 3)))
Exception: variable If is not bound
> #<procedure>
> (define nth-element
  (lambda (ls n)
    (if (null? ls)
	       "error"
	       (if (zero? n)
		   (car ls)
		   (nth-element (cdr ls) (- n 1))))))
> (nth-element '(a b c d e f) 4)
  (lambda (n)
    (* n 3)))
e
> #<procedure>
> (trace nth-element)
(nth-element)
> (nth-element '(a b c d e f) 4)
  (lambda (n)
    (* n 3)))
|(nth-element (a b c d e f) 4)
|(nth-element (b c d e f) 3)
|(nth-element (c d e f) 2)
|(nth-element (d e f) 1)
|(nth-element (e f) 0)
|e
e
> #<procedure>
>