Skip to content

Instantly share code, notes, and snippets.

@redsquirrel
Created September 18, 2009 17:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 8 You must be signed in to fork a gist
  • Save redsquirrel/189192 to your computer and use it in GitHub Desktop.
Save redsquirrel/189192 to your computer and use it in GitHub Desktop.
SICP 1.3
Fork me. Solve me.
====
(define (square a) (* a a))
(define (sum-of-squares a b) (+ (square a) (square b)))
(define (square-biggest-two a b c smallest)
(cond ((= a smallest) (sum-of-squares b c))
((= b smallest) (sum-of-squares a c))
((= c smallest) (sum-of-squares a b))
)
)
(define (sum-sizable-squares a b c) (square-biggest-two a b c (min a b c)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment