Fix section 1.1 solutions so they run in Racket

This commit is contained in:
Petar Kapriš 2025-02-04 19:09:58 +01:00
parent 8b37951b28
commit 16d2911936
3 changed files with 5 additions and 6 deletions

View file

@ -1,4 +1,5 @@
#| BEGIN (Write your solution here) |#
#lang sicp
(define (sqr x) (* x x))
(define (solution a b c)
(cond ((and (<= a b) (<= a c))
@ -6,4 +7,3 @@
((and (<= b a) (<= b c))
(+ (sqr a) (sqr c)))
(else (+ (sqr a) (sqr b)))))
#| END |#

View file

@ -1,4 +1,4 @@
#| BEGIN (Write your solution here) |#
#lang sicp
(define (average a b)
(/ (+ a b) 2))
@ -15,4 +15,3 @@
(define (square-root x)
(sqrt-iter 1.0 x))
#| END |#

View file

@ -1,4 +1,5 @@
#| BEGIN (Write your solution here) |#
#lang sicp
(define (improve guess x)
(/ (+ (/ x guess guess)
(* 2 guess))
@ -15,4 +16,3 @@
(define (cube-root x)
(cbrt-iter 1.0 x))
#| END |#