Petite Chez Scheme Version 9.5
Copyright 1984-2017 Cisco Systems, Inc.
> (define a '(2 3 4))
> a
(2 3 4)
> (define b (cons 1 a))
> (eq? a (cdr b))
#t
> (define c ( cons a b))
> c
((2 3 4) 1 2 3 4)
> (list a b)
((2 3 4) (1 2 3 4))
> (append a b)
(2 3 4 1 2 3 4)
> (/ 4 5)
4/5
> /
#
> (define /
(lambda (n m)
(+ (* m 2) n)))
> (/ 4 5)
Exception: incorrect number of arguments to #
> (define / (lambda (n m) (* m n)))
> /
#
> (/ 4 5)
20
> (mod 19)
Exception: incorrect argument count in call (mod 19)
> (mod 19 4)
3
> (max 3 6 2 1 4)
6
> (max 4)
4
> (max a)
Exception in max: (2 3 4) is not a real number
> (apply max a)
4
> (if 0 1 2)
1
> (if '() 1 2)
1
> (if #f 1 2)
2
> (if (< 5 2) 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
> (letter-to-number 'B+)
3.5
> (letter-to-number 'B)
3.0
> (define letter-to-number
(lambda (letter)
(cond
[(eq? letter 'A) 4.0]
[(eq? letter 'B+) 3.5]
[else 3.0])))
> (letter-to-number 'A)
4.0
> (letter-to-number 'B+)
3.5
> (letter-to-number 'B)
3.0
>