Functional Problem Solving (CSC 151 2015F) : EBoards

CSC151.01 2015F, Class 20: Naming Local Values


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Peer Support

Other Good Things (No EC)

Questions

Lab

Other than these stupid problems, why would we use let outside a procedure? (EG)

It's rare that we do so, but it's something useful to know. See extra 1 for an example.

For those of who are puzzled by bindings, can you give us some more questions?

What do you get for the following?

    (define alpha 3)

    (let ([alpha 5]
          [beta (+ alpha 1)])
       (list alpha beta))
    ; '(5 6)
    ; '(3 6)
    ; Error!
    ; '(3 4)

    (let* ([alpha 5]
           [beta (+ alpha 1)])
       (list alpha beta))

    (let ([delta 5]
          [epsilon (+ delta 1)])
      (list delta epsilon))

Why would someone change an existing procedure?

Sometimes your users are evil.

What is the lab writeup?

5d and 6b