summaryrefslogtreecommitdiff
path: root/coding-exercises/1/chapter115.rkt
blob: 0a026c662f81eaa9e2f747d81fab5424be635d0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#lang sicp
(define counter (box 0))

(define (cube x) (* x x x))
(define (p x) 
  (set-box! counter (+ (unbox counter) 1))
  (- (* 3 x) (* 4 (cube x))))
(define (sine angle)
  (if (not (> (abs angle) 0.1))
    angle
    (p (sine (/ angle 3)))))
(sine 1250.0)
(println "\n")
(println (unbox counter))