The graph1 Example

This example is adapted from Jensen and Wirth, Pascal User Manual and Report, Springer-Verlag, 1976, p. 30.


(define graph1-code
  '(lambda ()
     (let ((d 0.0625) (s 32) (h 34)
           (c 6.28318) (lim 32)
           (x 0.0) (y 0.0) (i 0) (n 0))
       (dotimes (i (+ lim 1))
         (set! x (* d i))
         (set! y (* (exp (- x))
                    (sin (* c x))))
         (set! n (+ (round (* s y)) h))
         (while (> n 0)
           (display " ")
           (set! n (- n 1)))
         (display "*")
         (newline) ) )))

Contents    Page-10    Prev    Next    Page+10    Index