Summary unavailable.

Questions

Question 1

In the context of programming with local state, what does it mean for an object to 'have state'?

View answer and explanation
Question 2

Given the function `const W1 = make_withdraw(100);`, what is the sequence of returned values from the following successive calls: `W1(50);`, `W2(70);`, `W2(40);`, `W1(40);` where `const W2 = make_withdraw(100);`?

View answer and explanation
Question 3

What is the primary conceptual cost or disadvantage of introducing assignment into a programming language, as discussed in section 3.1.3?

View answer and explanation
Question 4

In the environment model of evaluation, what does a function object consist of?

View answer and explanation
Question 5

What is the primary purpose of the `set_head` and `set_tail` operations introduced in Section 3.3.1?

View answer and explanation
Question 6

A queue is described as a FIFO buffer. What does FIFO stand for?

View answer and explanation
Question 7

In the efficient queue implementation in Section 3.3.2, how is a queue represented to allow for constant-time (Theta(1)) insertions?

View answer and explanation
Question 8

What is the primary problem that arises in concurrent programming when two threads, such as Peter's and Paul's withdrawals, attempt to modify a shared variable like `balance`?

View answer and explanation
Question 9

What is the function of a 'serializer' as introduced in Section 3.4.2?

View answer and explanation
Question 10

In the context of the digital circuit simulator, what are the three primitive operations on wires used to build function boxes?

View answer and explanation
Question 11

How does the stream-based approach to modeling state differ from the assignment-based approach?

View answer and explanation
Question 12

What is the key mechanism that allows streams to represent very long or infinite sequences efficiently without constructing them all at once?

View answer and explanation
Question 13

What is the result of evaluating `stream_ref(primes, 50);` where `primes` is the stream of prime numbers generated by the sieve of Eratosthenes as defined in Section 3.5.2?

View answer and explanation
Question 14

What happens in the environment model when a function is applied to a set of arguments?

View answer and explanation
Question 15

In the `make_account` function from Section 3.1.1, how are the `withdraw` and `deposit` functions able to access and modify the `balance` variable?

View answer and explanation
Question 16

A situation where a single computational object can be accessed by more than one name is known as what?

View answer and explanation
Question 17

In the Monte Carlo simulation to estimate pi, what is the mathematical fact that the `dirichlet_test` function is based on?

View answer and explanation
Question 18

What is the result of applying the `mystery` function from Exercise 3.14 to the list `v` defined as `const v = list("a", "b", "c", "d");`?

View answer and explanation
Question 19

In the digital circuit simulator, what is the specified delay for an `and_gate` in the sample simulation of Section 3.3.4?

View answer and explanation
Question 20

What is a 'deadlock' in the context of concurrent programming?

View answer and explanation
Question 21

What does the stream `const integers = pair(1, () => add_streams(ones, integers));` represent?

View answer and explanation
Question 22

According to the Euler transform for accelerating sequence convergence, if `s0`, `s1`, and `s2` are three consecutive terms in a stream, what is the corresponding term in the transformed sequence?

View answer and explanation
Question 23

What is the key insight of the `interleave` function that allows `pairs(integers, integers)` to eventually generate all pairs of integers, unlike `stream_append`?

View answer and explanation
Question 24

In the stream-based model of an RC circuit in Exercise 3.73, what does the feedback loop in the signal-flow diagram correspond to in the `integral` function's definition?

View answer and explanation
Question 25

What problem does the normal-order evaluation model solve that is present in the delayed-stream model of Section 3.5.4?

View answer and explanation
Question 26

In the imperative version of the factorial function in Section 3.1.3, why is the order of the two assignment statements `product = counter * product;` and `counter = counter + 1;` critical?

View answer and explanation
Question 27

What is the result of evaluating `const z1 = pair(x, x);` where `const x = list("a", "b");` followed by `set_head(head(z1), "wow");`?

View answer and explanation
Question 28

In the table implementation from Section 3.3.3, what is the role of the dummy record `"*table*"` at the beginning of the headed list?

View answer and explanation
Question 29

What is the fundamental flaw in Louis Reasoner's proposed `squarer` constraint from Exercise 3.34, defined as `function squarer(a, b) { return multiplier(a, a, b); }`?

View answer and explanation
Question 30

What is the term for a programming style that makes extensive use of assignment?

View answer and explanation
Question 31

In the `make_monitored` function from Exercise 3.2, if you create `const s = make_monitored(math_sqrt);`, what is the returned value of a second call to `s("how many calls");` after an initial call of `s(100);`?

View answer and explanation
Question 32

What is the mechanism that allows local functions within the `sqrt` function (e.g., `is_good_enough`) to access the argument `x` of the enclosing `sqrt` function?

View answer and explanation
Question 33

In the context of the `make_account` function from exercise 3.3 that is password-protected, where is the password stored?

View answer and explanation
Question 34

What does a 'mutex' object, as described in Section 3.4.2, support?

View answer and explanation
Question 35

In the functional implementation of mutable pairs in Section 3.3.1, how is a pair represented?

View answer and explanation
Question 36

What is the key problem with the simple `count_pairs` function written by Ben Bitdiddle in Exercise 3.16?

View answer and explanation
Question 37

In the lazy evaluator, what is a 'thunk'?

View answer and explanation
Question 38

What is the primary benefit of memoizing thunks in a lazy evaluator, as mentioned in Section 4.2.2?

View answer and explanation
Question 39

What is the value of `sum` after executing `stream_ref(y, 7);` given the definitions in Exercise 3.52, where `seq` is a stream mapping `accum` over integers 1 to 20, and `y` is the stream of even numbers from `seq`?

View answer and explanation
Question 40

What is the fundamental problem with using `stream_append` to combine two infinite streams?

View answer and explanation
Question 41

In the concurrent `exchange` function example, what is the purpose of acquiring serializers for both accounts involved in the transaction?

View answer and explanation
Question 42

Given the initial values `s0 = 4`, `s1 = 2.666...`, and `s2 = 3.466...` from the `pi_stream`, what is the first value produced by `euler_transform`?

View answer and explanation
Question 43

What is the fundamental difference between the `integers_starting_from` stream function and the `an_integer_starting_from` amb function?

View answer and explanation
Question 44

In the `solve` function for differential equations in Section 3.5.4, why is the `dy` argument to `integral` written as `() => dy`?

View answer and explanation
Question 45

What is the value of the `balance` variable in the `make_simplified_withdraw(25)` example after the first call `W(20)` and the second call `W(10)`?

View answer and explanation
Question 46

In the `count_pairs` function from Exercise 3.16, for which structure would the function never return a value?

View answer and explanation
Question 47

In the stream formulation of the Monte Carlo estimation of pi in Section 3.5.5, how are better estimates of pi obtained?

View answer and explanation
Question 48

If Peter's and Paul's joint account starts with 100 dollars, and Peter concurrently deposits 40 dollars while Paul withdraws half the money, what are the two possible correct final balances assuming the operations are correctly serialized?

View answer and explanation
Question 49

How does the `make_tableau` function in Section 3.5.3 generate a 'stream of streams'?

View answer and explanation
Question 50

What is the primary modularity benefit of using the `rand` function with hidden local state, compared to passing the state explicitly as in the `random_gcd_test` example?

View answer and explanation