Chapter 3, Modularity, Objects, and State
Exercise 3.58
It gives the decimal part when we pass 10 as radix. Thus it gives the decimal part of the number $\,\frac {num} {den}\,$ in base radix
.
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
1 ]=> (define xxx (expand 1 7 10))
;Value: memo-proc
1 ]=>
;Value: xxx
1 ]=> xxx
;Value 5: (1 . #[compound-procedure 6])
1 ]=> (stream-ref xxx 0)
;Value: 1
1 ]=> (stream-ref xxx 1)
;Value: 4
1 ]=> (stream-ref xxx 2)
;Value: 2
1 ]=> (stream-ref xxx 3)
;Value: 8
1 ]=> (define yy (expand 3 8 10))
;Value: yy
1 ]=> (stream-ref yy 0)
;Value: 3
1 ]=> (stream-ref yy 1)
;Value: 7
1 ]=> (stream-ref yy 2)
;Value: 5
1 ]=> (stream-ref yy 3)
;Value: 0
1 ]=> (stream-ref yy 4)
;Value: 0
1 ]=> (stream-ref yy 5)
;Value: 0
1 ]=>