Created
September 15, 2014 18:20
-
-
Save josephmosby/15835c87c069015caf0d to your computer and use it in GitHub Desktop.
Saving accomplishments in Lisp because parentheses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define (find-largest x y z) | |
(cond ((and (> x y) (> x z)) x) | |
((and (> y z) (> y x)) y) | |
((and (> z x) (> z y)) z))) | |
(define (find-second-largest x y z) | |
(cond ((and (> y x) (< y z)) y) | |
((and (> z y) (< z x)) z) | |
((and (> x z) (< x y)) x))) | |
(define (square x) (* x x)) | |
(define (sum-of-greatest x y z) (+ (square (find-largest x y z)) (square (find-second-largest x y z)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment