SCIP 1.3


Exercise 1.3. Define a procedure that takes three numbers as arguments and returns the sum of the
squares of the two larger numbers.

CL-USER> (defun sum-squre( x y )
	   (+ (* x x)
	      (* y y)))
SUM-SQURE
CL-USER>  (defun sum-squre-two-larger-in-three-numbers(x y z)
	   (cond ((and (<= x y) (<= x z)) (sum-squre y z))
		 ((and (<= y x) (<= y z)) (sum-squre x z))
		 ((and (<= z x) (<= z y)) (sum-squre x y))))

SUM-SQURE-TWO-LARGER-IN-THREE-NUMBERS
CL-USER> (sum-squre-two-larger-in-three-numbers 3 4 5)
41
CL-USER> (sum-squre-two-larger-in-three-numbers 3 -4 5)
34

  
Edit in Emacs with Slime and Steel Bank Common Lisp.