;; The first three lines of this file were inserted by DrRacket. They record metadata ;; about the language level of this file in a form that our tools can easily process. #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname scope-let-let*-examples) (read-case-sensitive #t) (teachpacks ()) (htdp-settings #(#t constructor repeating-decimal #f #t none #f () #f))) (define (foo x) (+ x b)) (define b 99) (define a (sqrt b)) (cons b (let* {[a (* a b)] [b (* a b)] [c (* a b)]} (cons a (cons b (cons c '()))))) class Foo { int n; void helper() { print(n); int n = n+2; print(n); } } ; Syntax of `let`: #;(let { ... } ) ; syntax for ``: ; [ ] ; WHY doe we use variables? ; (1) avoid repeated computations ; (2) give meaningful names to sub-computations that will lead to my overall result (cons b (let {[a 15] [b (+ 2 3)] [c (* a b)]} (cons a (cons b (cons c '()))))) (cons b (let {[a 15] [b (+ 2 3)] } (let {[c (* a b)]} (cons a (cons b (cons c '())))))) (cons b (let {[a 15] [b (+ 2 3)]} (let {[c (* a b)]} (cons a (cons b (cons c '()))))))