Functional Problem Solving (CSC 151 2016S) : EBoards

CSC151.02 2016S, Class 08: Writing Your Own Procedures


Overview

Preliminaries

Admin

Reminders

Upcoming Work:

Extra Credit

Academic

Peer

Regular Peer

No Extra Credit, But Still Good

Questions

Quiz

Lab

Three important lessons from today's lab ....

  1. The (define ...) tab is really useful.

  2. If you write

    (define bound
      (lambda (val lower upper)
        (min (max val lower) upper)))
    

and then call

    (bound 5 0 10)

DrRacket substitutes 5 for val, 0 for lower, and 10 for upper, giving

    (min (max 0 5) 10)

Which it then computes.

  1. Indentation can improve readability

    (define rgswap (lambda (color) (irgb (irgb-green color) (irgb-red color) (irgb-blue color))))
    
    
    (define rgswap
      (lambda (color)
        (irgb (irgb-green color)
              (irgb-red color)
              (irgb-blue color))))
    
  2. Zachary says "Save early and often."

  3. Sarah says "Mark where you are in the lab."