You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
595 B
73 lines
595 B
|
|
Exercise 3.69: Write a procedure triples
|
|
that takes three infinite streams,
|
|
S
|
|
,
|
|
T
|
|
, and
|
|
U
|
|
, and produces the
|
|
stream of triples
|
|
|
|
(
|
|
|
|
S
|
|
i
|
|
|
|
,
|
|
|
|
T
|
|
j
|
|
|
|
,
|
|
|
|
U
|
|
k
|
|
|
|
)
|
|
|
|
such that
|
|
|
|
i
|
|
≤
|
|
j
|
|
≤
|
|
k
|
|
|
|
.
|
|
Use triples to generate the stream of all Pythagorean
|
|
triples of positive integers, i.e., the triples
|
|
|
|
(
|
|
i
|
|
,
|
|
j
|
|
,
|
|
k
|
|
)
|
|
|
|
such that
|
|
|
|
|
|
i
|
|
≤
|
|
j
|
|
|
|
and
|
|
|
|
|
|
i
|
|
2
|
|
|
|
+
|
|
|
|
j
|
|
2
|
|
|
|
=
|
|
|
|
k
|
|
2
|
|
|
|
|
|
.
|
|
|