;; Exercise 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.

(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))))

Attached: 1537871406132.png (724x674, 491K)

Other urls found in this thread:

more-magic.net/posts/internals-gc.html
twitter.com/SFWRedditImages

i don't fucking understand this shit

It's simpler in structure than other programming languages.

What exactly don't you understand?

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.

*reverse-polish notation.

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.

Actually no, Lisp uses Polish notation.

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

>another if statement as a predicate
no they didn't