-
Notifications
You must be signed in to change notification settings - Fork 0
/
print.scm
72 lines (54 loc) · 1.1 KB
/
print.scm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
(load "./mini.scm")
(eval-toplevel-list '(
(display "hello")
(newline)
(write "hello")
(newline)
(display #t)
(newline)
(display 123)
(newline)
(display ())
(newline)
(display (lambda (a b) (+ a b)))
(newline)
(display cons)
(newline)
(write (cons 1 (cons (cons 2 (cons "A" "B")) (cons 3 4))))
(newline)
(write (cons 1 (cons 2 (cons 3 4))))
(newline)
(write (cons 1 (cons 2 (cons 3 ()))))
(newline)
(write (cons 1 2))
(newline)
(define l (cons 1 (cons 2 ())))
(set-car! (cdr l) l)
(write l)
(newline)
(define l (cons 1 (cons 2 ())))
(set-cdr! (cdr l) l)
(write l)
(newline)
(guard
(e (else (write e)))
(< "hello" "world"))
(newline)
(define port (open-input-file "./samples/empty.scm"))
(write port)
(newline)
(write (read port))
(newline)
(close-port port)
(guard
(err
((<system-error> err) (write err)))
(open-input-file "./samples/undefined"))
(newline)
(define port (open-input-file "./samples/err.scm"))
(guard
(err
((<read-error> err) (write err)))
(read port))
(newline)
) (env-init))