内容 4.3 Variations on a Scheme — Nondeterministic Computing · 348
练习 自检推理
Exercise 4.36: Exercise 3.69 discussed how
to generate the stream of all Pythagorean triples, with no upper bound
on the size of the integers to be searched. Explain why simply replacing
an-integer-between by an-integer-starting-from in the procedure
in Exercise 4.35 is not an adequate way to generate arbitrary Pythagorean
triples. Write a procedure that actually will accomplish this. (That is,
write a procedure for which repeatedly typing try-again would in
principle eventually generate all Pythagorean triples.)
练习 4.36:练习 3.69 讨论了如何生成所有勾股数组的流,其中对所搜索整数的大小没有上界。请解释为什么仅仅将练习 4.35 中过程里的 an-integer-between 换成 an-integer-starting-from,并不是生成任意勾股数组的合适方法。请编写一个实际能完成这一任务的过程。(即编写一个过程,对它反复输入 try-again,原则上最终能生成所有的勾股数组。)
我的笔记 自动保存