3.1.1 Local state variables

xiaoxiao2021-03-06  39

Once the assignment is introduced in the language, the replacement model is no longer suitable for the model of the process, and the new model is an environment model.

Exercise 3.2: (Make-Monitored Func) (Define (Call N)) (a (set! Count) (FUNC N)) (DEFINE (Define (Reset! (set! count 0)); sub-process; define (DISPATCH M) (COND ((EQ? M 'How-Many-Calls); do not write a sub-process ((EQ) ? M 'reset-count) (Else (Call M)))) DISPATCH))

Lessons: According to my experience, in the programming method of the message (Dispatch), if a child does not have a parameter, do not write it into a sub-process, write the code directly on the corresponding, OK.

转载请注明原文地址:https://www.9cbs.com/read-56849.html

New Post(0)