Functional Problem Solving (CSC 151 2014F) : EBoards

CSC 151: Extra Session 4 (Thursday, 25 Sept. 2014)


What is going to be on the quiz tomorrow?

What do you see as the standard color transformations and what do we need to do with them?

Could you give us some sample quiz questions?

Additional Questions

Example: Write a function, (redder-by! image amount), which increases the red component of the given image by the specified amount. For example, (redder-by! casey 20), the red component of each pixel should increase by 20 (up to 255). Similarly, `(redder-by! casey -5)1, the red component of each pixel should decrease by 5 (increase by -5)

(define redder-by!
   (lambda (image amount)
      (image-transform! image
                        (lambda (color) (irgb (+ amount (rgb-red color))
                                              (irgb-green color)
                                              (irgb-blue color))))))

vs.

(define redder-by!
  (lambda (image amount)
    (image-transform! image somewhat-redder)))
(define somewhat-redder
  (lambda (color)
    (irgb (+ amount (irgb-red color))
          (irgb-green color)
          (irgb-blue color))))

The problem in the second is that somewhat-redder doesn't have access to amount.