The problem i am having is that i have been given this code to test and use to analyse. Except when i run it, the print definition is being complained about. It keeps saying "print: undefined"
Can anyone supply me with a print definition which will suit this problem?
(define (integral integrand initial-value dt)
(define int
(cons-stream initial-value
(add-streams (scale-stream integrand dt)
int)))
int)
(define (RC R C dt)
(define (vs is v0)
(cons-stream v0
(add-streams (scale-stream is R)
(integral (scale-stream is (/ 1 C)) v0 dt))))
vs)
(define RC1 (RC 5 1 0.5))
(define s (RC1 ones 10))
(do ((i 0 (+ i 1)))
((= i 30))
(print (stream-ref s i)))
The language in DrRacket that must be used for this is R5RS, which i believe is why the print definition is undefined
The print
procedure is not defined in R5RS, replace it with display
, which is standard. If you need to insert a line break, use (newline)
.