;;; Day 4 code, Michael Wollowski (define (rl) (load "day4.ss")) (define double-any (lambda (arg1 arg2) (arg1 arg2 arg2))) (define regular-cons (lambda (h t) (cons h t))) (define curry-cons (lambda (h) (lambda (t) (cons h t)))) (define any-number-of-args (lambda ls ls)) (define variable-num-args (lambda (x y . z) (list x y z))) (define mystery (lambda 'x 'x)) (define mystery2 (lambda (if x) (if x))) (define pythagoras (lambda (x y) (let ([x-squared (* x x)] [y-squared (* y y)]) (let ([hypotenuse (sqrt (+ x-squared y-squared))]) hypotenuse)))) ;(define pythagoras ; (lambda (x y) ; (let ([x-squared (* x x)] ; [y-squared (* y y)] ; [hypotenuse (sqrt (+ x-squared y-squared))]) ; hypotenuse)))) ;(define pythagoras ; (lambda (x y) ; ((lambda (x-squared y-squared hypothenuse) ; hypothenuse) ; (* x x) ; (* y y) ; (sqrt (+ x-squared y-squared))))) (define pythagoras (lambda (x y) (let* ([x-squared (* x x)] [y-squared (* y y)] [hypotenuse (sqrt (+ x-squared y-squared))]) hypotenuse))) (define pythagoras (lambda (x y) (let ([x-squared (* x x)]) (let ([y-squared (* y y)]) (let ([hypotenuse (sqrt (+ x-squared y-squared))]) hypotenuse))))) (define pythagorasLambda (lambda (x y) ((lambda (x-squared) ((lambda (y-squared) ((lambda (hypothenuse) hypothenuse) (sqrt (+ x-squared y-squared)))) (* y y))) (* x x))))