pop quiz

Grug asks a question from every topic. Say the answer out loud, then tap. what junior miss come back sooner. what junior know go away for a while.

The cards below are a no-script preview. With the page script on, the whole question bank loads from quiz-bank.js and grug draws from it instead.

level 2 of 6Q1 · What does apply do to the balance for one entry?
try first, then show answer

4. It adds the delta to the balance

why

apply has one operation: balance + delta. A credit adds; a debit is a negative delta.

from one entry changes a balance by a fixed amount

level 3 of 6Q2 · What does replay preserve by folding left to right?
try first, then show answer

4. The order in which deltas reach the balance

why

A fold over a list visits entries in order. The balance after each step is the input to the next step.

from replay is one fold over the entries

level 3 of 6Q3 · Where does the expected balance come from?
try first, then show answer

2. start plus List.sum deltas

why

start + List.sum deltas is independent of apply. It stays correct when apply changes.

from the oracle is a closed form, not a transcription

level 3 of 6Q4 · Where does a wrong sign in apply reach the replayed balance?
try first, then show answer

2. In every step of the fold, because replay calls apply for each entry

why

replay folds over the entries with the same addition, so a wrong sign in apply changes every step. The closed-form oracle uses List.sum, which stays correct when the implementation changes.

from one entry changes a balance by a fixed amount

level 4 of 6Q5 · If replay used foldBack with subtraction, what would a correct closed-form check show?
try first, then show answer

3. The replayed balance differs from the sum, so the check goes red

why

Subtraction over the same entries from the right gives a different answer. The closed-form oracle uses addition, which does not change with the implementation, so the mismatch is visible.

from replay is one fold over the entries

level 5 of 6Q6 · A test computes its expected balance by calling apply. What happens after + becomes -?
try first, then show answer

1. The test goes green because both sides use the same wrong operation

why

Both sides change together when the oracle calls the implementation. A green result then says the two agree, not that either is correct.

from the oracle is a closed form, not a transcription