内容 3.3 Modeling with Mutable Data · 237
练习 自检推理
Exercise 3.32: The procedures to be run during
each time segment of the agenda are kept in a queue. Thus, the procedures for
each segment are called in the order in which they were added to the agenda
(first in, first out). Explain why this order must be used. In particular,
trace the behavior of an and-gate whose inputs change from 0, 1 to 1, 0 in the
same segment and say how the behavior would differ if we stored a segment’s
procedures in an ordinary list, adding and removing procedures only at the
front (last in, first out).
练习 3.32:议程中每个时间段内待运行的过程保存在一个队列中。因此,每个时间段的过程按照加入议程的顺序依次调用(先进先出)。请解释为什么必须采用这种顺序。具体而言,追踪一个与门的行为——其输入在同一时间段内从 0、1 变为 1、0——并说明若将一个时间段的过程存储在普通表中、仅在前端添加和删除过程(后进先出),行为将有何不同。
我的笔记 自动保存