Triples procedure
Write a procedure
triples
that takes three infinite streams,
S
,
T
, and
U
, and produces the stream of triples
(Si, Tj, Uk)
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² + j² = k²
.