Functional Problem Solving (CSC 151 2013F) : EBoards

CSC151.02 2013F, Class 13: Transforming Colors


Overview

Admin

A bit more about documentation

;;; Procedure: ;;; rectangle ;;; Parameters: ;;; left, a real number ;;; top, a real number ;;; width, a positive real number ;;; height, a positive real number ;;; color, a color (whatever that is) ;;; Purpose: ;;; Create a rectangle with the specified characteristics. ;;; OR ;;; Create a rectangle with left edge left, and top edge top, and width width, ;;; and height height, colored color. ;;; Produces: ;;; rect, a drawing ;;; Preconditions: ;;; color is an element of (context-list-colors) ;;; Postconditions: ;;; (drawing-rectangle? rect) is #t ;;; (drawing-width rect) is width ;;; (drawing-height rect) is height ;;; (drawing-top rect) is top ;;; (drawing-left rect) is left ;;; rect is colored color ;;; Problems: ;;; If (left+width < 0) this drawing will not render as given.

Additional

;;; Practica ;;; Props ;;; Philosophy/Ponderings

The produces section should give a name and a type so that we can talk about it.

Postcondition possibliities

;;; [No additional] ;;; vs. ;;; color is an element of (context-list-colors) ;;; vs. ;;; (left + width) > 0 ;;; (top + height) > 0

One set of postconditions (problem: Talk about algorithm, rather than the goal.)

;;; Post-conditions: ;;; drawing-hshift moves the drawing to the left or right depending on the value given ;;; drawing-vshift moves the drawing to the up or down depending on the value given ;;; drawing-hscale stretches the drawing horizontally to provide the drawing with its width ;;; drawing-vscale stretches the drawing vertically to provide the height of the drawing ;;; drwaing-recolor gives the drawing the color based on the choice of color desired in the list of default colors

Questions about the exam

Questions before the quiz

Quiz

Lab


Samuel A. Rebelsky, rebelsky@grinnell.edu

Copyright (c) 2007-2013 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.