]> git.rkrishnan.org Git - sicp.git/blob - src/sicp/ex3_34.rkt
Solution to 4.33. This had been difficult to get right, though conceptually it was
[sicp.git] / src / sicp / ex3_34.rkt
1 #lang racket
2
3 #|
4
5 If Louis Reasoner implements the squarer with a multiplier, like this:
6
7 (define (squarer a b)
8   (multiplier a a b))
9
10 let us see how we will use it.
11
12 (define a (make-connector))
13 (define b (make-connector))
14
15 (set-value! a 10 'user)
16
17 At this point, we expect b to have the value 100. Indeed it is. Now, instead
18 we set the value of b to be 400. But multiplier needs two values to operate.
19 We have set only b. So, the contraint never propagates to a. Here is the
20 output of a repl session:
21
22 > (set-value! e 400 'user)
23
24 Probe: squarer output = 400
25 'done
26
27
28 |#