;; Exercise 1.3. ;; Define a procedure that takes three numbers as arguments and returns the sum of the squares of the two larger numbers.
(define (square x) (* x x)) (define (sum-of-squares x y) (+ (square x) (square y)))
(define (sum-two-largest-squares x y z) (if (> x y) (if (> y z) (sum-of-squares x y) (sum-of-squares x z)) (if (> x z) (sum-of-squares x y) (sum-of-squares y z))))
It's simpler in structure than other programming languages.
Kevin Cooper
What exactly don't you understand?
Joseph Walker
Are you stupid or do you just not understand lisp's polish notation? It's doing middle school math with 2 simple functions and 3 simple if statements.
Julian Bailey
*reverse-polish notation.
Ian Murphy
So this person wrote another if statement as a predicate under (if )
?? I just started today ok, I feel really stupid already. I have to freaking create a tree just to follow their if statements.
Chase Myers
Actually no, Lisp uses Polish notation.
Dominic Morgan
lisp makes sense, it would look good too if it wernt for all the paren. cant do anything about that tho. Also using rpn keeps the tards out of your language
Nathaniel Sanders
>another if statement as a predicate no they didn't