;; ------------------------------------------------------------------------ ;; | FILE : opening-exercise.rkt | ;; | AUTHOR : Eugene Wallingford | ;; | CREATION DATE : 2024/03/19 | ;; | DESCRIPTION : demonstrating let expressions | ;; ------------------------------------------------------------------------ #lang racket ;; ---------------------------------------------------------------------- ;; Opening Exercise ;; ---------------------------------------------------------------------- ;; (define (exercise1) ;; (let ((x 5) ;; (y 6) ;; (z 7)) ;; (- (+ x z) y))) ;; (define (exercise2) ;; (let ((x 13) ;; (y (+ 6 x)) ;; (z x)) ;; (- (+ x z) y))) ;; ---------------------------------------------------------------------- ;; Exercise 2, Fixed ;; (define (exercise2) ;; (let ((x 13)) ;; (let ((y (+ 6 x)) ;; (z x)) ;; (- (+ x z) y)))) ;; ---------------------------------------------------------------------- ;; A variant of Exercise 2, from the reading ;; ---------------------------------------------------------------------- ;; (let ((x 13) ;; (y (+ y x)) ; the difference is here ;; (z x)) ;; (- (+ x z) y)) ;; ----------------------------------------------------------------------