Petite Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.
> (define a '(3 4 5))
> (cdr a)
(4 5)
> a
(3 4 5)
> (cddr a)
(5)
> (cdddr a)
()
> (cddddr a)
Exception in cddddr: incorrect list structure (3 4 5)
> (cdddddr a)
Exception: variable cdddddr is not bound
> (define b (cons 2 a))
> (define b (cons 1 a))
> b
(1 3 4 5)
> (define c (cons a b))
>c
>c
Exception: variable >c is not bound
> c
((3 4 5) 1 3 4 5)
> (car c)
(3 4 5)
> (cdr c)
(1 3 4 5)
> (/ 4 5)
4/5
> /
#
> (define /
(lambda (x y)
(+ (* 2 x) y)))
> (/ 4 5)
13
> (max 3 4 5 2)
5
> (max a)
Exception in max: (3 4 5) is not a real number
> (apply max a)
5
> (mod 19 4)
3
> (define t 6)
> (void)
> (list (void))
(#)
> (if 0 1 2)
1
> (if '() 1 2)
1
> (if (void) 1 2)
1
> (if #f 1 2)
2
> (If (> 3 4) 1 2)
Exception: variable If is not bound
> (if (> 3 4) 1 2)
2
> (define letter-to-number
(lambda (letter)
(if (eq? letter 'A)
4.0
(if (eq? letter 'B+)
3.5
3.0))))
> (letter-to-number 'A)
4.0
>