[racket] SICP (again)

From: Joshua TAYLOR (joshuaaaron at gmail.com)
Date: Wed Nov 26 06:56:32 EST 2014

Why not just do:

(define (square x)
  (* x x))

?

On Wed, Nov 26, 2014 at 5:37 AM, Catonano <catonano at gmail.com> wrote:
> Hello
>
> 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)
>         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
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>



-- 
Joshua Taylor, http://www.cs.rpi.edu/~tayloj/

Posted on the users mailing list.