Skip to content

Instantly share code, notes, and snippets.

@jimmyp
Created May 8, 2013 05:07
Show Gist options
  • Save jimmyp/5538332 to your computer and use it in GitHub Desktop.
Save jimmyp/5538332 to your computer and use it in GitHub Desktop.
Ex 1.3 SICP
(define (max1 a b c)
(cond ((and (> a b)(> b c)) a)
((and (> a b)(> c b)) a)
(else c)))
(define (max2 a b c)
(cond ((and (> a b)(> b c)) b)
((and (> a b)(> c b)) c)
(else b)))
(define (square x) (* x x))
(define (sum-square a b) (+ (square a) (square b)))
(define (sum-square-max2 a b c) (sum-square (max1 a b c)(max2 a b c)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment