Functional Problem Solving (CSC 151 2014S) : EBoards

CSC151.02 2014S, Class 13: Transforming Colors


Overview

Preliminaries

Admin

Upcoming Work

About Quiz 3

Part 1: Code is in examples/math.rkt.

Basically, each procedure prints stuff out in addition to computing a result. I wanted you to tell me what was printed out.

Part 2:

;;; Procedure:
;;;   limit
;;; Parameters:
;;;   val, a real number
;;;   lower, a real number
;;;   upper, a real number
;;; Purpose:
;;;   limit val so that it is between lower and upper.
;;; Produces:
;;;   limited, a real number
;;; Preconditions:
;;;   lower <= upper
;;; Postconditions:
;;;   If val < lower, the result is lower
;;;   If val > upper, the result is upper
;;;   Otherwise, the result is val.
(define limit
  (lambda (val lower upper)
    (max lower (min val upper))))

Questions on the Exam

Should #9 show the image?

No. It should give back a number that we can use with image-show.

Can we convert images to drawings

Not yet.

Other Questions

Lab

It may be hard for some eyes to distinguish slightly darker versions of colors.


Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2014 Janet Davis, Samuel A. Rebelsky, and Jerod Weinman. (Selected materials are copyright by John David Stone or Henry Walker and are used with permission.)

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/3.0/ or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.