(define (expand num den radix) (cons-stream (quotient (* num radix) den) (expand (remainder (* num radix) den) den radix))) ; expand provides the decimal expansion of the fraction num / den in base radix ; when num < den ; 1 ]=> (stream-prefix (expand 1 7 10) 20) ; ; ;Value: (1 4 2 8 5 7 1 4 2 8 5 7 1 4 2 8 5 7 1 4) ; ; 1 ]=> (/ 1.0 7.0) ; ; ;Value: .14285714285714285 ; ; 1 ]=> (stream-prefix (expand 3 8 10) 5) ; ; ;Value: (3 7 5 0 0) ; ; 1 ]=> (/ 3.0 8.0) ; ; ;Value: .375