lmarburger (owner)

Revisions

gist: 213912 Download_button fork
public
Public Clone URL: git://gist.github.com/213912.git
Embed All Files: show embed
sum-of-squares.scm #
1
2
3
4
5
6
7
8
9
(define (sum-of-squares a b c)
  (define smallest
    (cond ((and (< a b) (< a c)) a)
          ((and (< b a) (< b c)) b)
          (else c)))
 
  (cond ((= smallest a) (+ (* b b) (* c c)))
        ((= smallest b) (+ (* a a) (* c c)))
        (else (+ (* a a) (* b b)))))