; Chapter 7.5 ; Let the missing ; What is "let"? It's that bit of scheme that's not in the book. ; ; What is "let" for? It's a way of giving a name to something that you're ; going to use more than once. ; ; Do you have to use it? No. But your program will become even ; harder to read. ; ; Give an example of let (let ((x 2)) (+ x x)) ; What would have been a (+ 2 2) ; shorter way to write ; that? ; ; Even shorter? 4 ; ; Why is that? Because scheme gives "x" the value of 2 inside ; the let. ; ; Could you have used a Yes. ; define for that? ; ; Why not then? Except in the simplest cases, you can't use a define ; inside a define. Plus, it leads to scary programs. ; ; Why not just use 2 You could, but if "x" has a complicated value, then ; twice, then? it makes it a lot easier to read. ; ; Give an example of that (let ((x (+ 4 (* 3 5)))) (+ x x)) ; which is a lot easier to read than this: (+ (+ 4 (* 3 5)) (+ 4 (* 3 5)))