Initial commit
This commit is contained in:
parent
83561bfec1
commit
dc0dd132b8
17
SICP/exercise_1_3.janet
Normal file
17
SICP/exercise_1_3.janet
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
(defn max [a b]
|
||||
(if (> a b) a b))
|
||||
|
||||
(defn min [a b]
|
||||
(if (> a b) b a))
|
||||
|
||||
(defn square [a]
|
||||
(* a a))
|
||||
|
||||
(defn sum-of-squares [a b c]
|
||||
(-
|
||||
(+ (square a) (square b) (square c))
|
||||
(square (min a (min b c)))))
|
||||
|
||||
(print (sum-of-squares 1 2 3))
|
||||
(print (sum-of-squares 3 1 2))
|
||||
(print (sum-of-squares 2 3 1))
|
||||
Loading…
Reference in New Issue
Block a user