[racket] SICP (again)

From: Catonano (catonano at gmail.com)
Date: Wed Nov 26 05:37:20 EST 2014


I understand that this is not the first time someone asks about using
Racket for a SICP study group.

I used the not so mantained mit-scheme compatibility package and I tried to
paste this piece of code

(define (average x y)
    (/ (+ x y) 2))

(define (sqrt x)
    (define (improve guess)
        (average guess (/ x guess )))
    (define (good-enough? guess)
        (< (abs (- (square guess) x )) .001))
    (define (try guess)

        (if (good-enough? guess)
            (try (improve guess))))
        (try 1))

It should be the Newton's method to calculate the square root

We copied it from the lectures

In this code we use the "square" function. In mit-scheme it's ok, in Racket
it's not defined

Should I import any module ?

Are common functions named as in mit-scheme ? Or are we gonna run into
compatibility issues ?

Thanks for any hint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20141126/7b78d7b1/attachment.html>

Posted on the users mailing list.