-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlec4.scm
More file actions
49 lines (38 loc) · 765 Bytes
/
lec4.scm
File metadata and controls
49 lines (38 loc) · 765 Bytes
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
(define x (delay (+ 1 2)))
(force x)
(define-syntax lazy-cons
(syntax-rules ()
((_ a b) (cons a (delay b)))))
(define (lazy-cdr ls) (force (cdr ls)))
(define lazy-car car)
(define (fib-gen a b)
(lazy-cons a (fib-gen b (+ a b))))
(define (lazy-ref ls n)
(if (zero? n)
(lazy-car ls)
(lazy-ref (lazy-cdr ls) (- n 1))))
#|
input-port?
output-port?
(current-input-port)
(close-input-port port)
(close-output-port port)
(open-input-file path)
(open-output-file path)
(read)
(read port)
(read-char [port])
(peek-char [port])
(eof-object?)
(char-ready? port)
(write x port)
(display x port)
(newline)
with-input-to-file
with-output-to-file
call-with-input-file
call-with-output-file
|#
(define name1 'abc)
(define name2 'x)
`(,name1 ,name2)