0

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

Swallows
  • 199
  • 1
  • 1
  • 11
  • Also know that there is a [SICP compability language in DrRacket](https://stackoverflow.com/questions/19546115/which-lang-packet-is-proper-for-sicp-in-dr-racket/19561746#19561746), but it doesn not have a binding for `print`. – Sylwester Oct 05 '17 at 11:51

1 Answers1

2

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).

Óscar López
  • 232,561
  • 37
  • 312
  • 386