Functional Problem Solving (CSC 151 2015F) : Outlines
Primary: [Front Door] [Schedule] - [Academic Honesty] [Disabilities] [Email] - [FAQ] [Teaching & Learning] [Grading] [Taking Notes] [Rubric] [Remote Access]
Current: [Assignment] [EBoard] [Lab] [Outline] [Reading]
Sections: [Assignments] [EBoards] [Labs] [Outlines] [Readings] - [Examples] [Handouts]
Reference: [Setup] [VM] [Errors] - [Functions A-Z] [Functions By Topic] - [Racket] [Scheme Report (R5RS)] [R6RS] [TSPL4]
Related Courses: [Curtsinger (2015F)] [Davis (2013F)] [Rebelsky (2015S)] [Weinman (2014F)]
Misc: [Submit Questions] - [SamR] [Glimmer Labs] [CS@Grinnell] [Grinnell] - [Issue Tracker (Course)]
Held: Monday, 14 September 2015
Back to Outline 09 - Writing Your Own Procedures, Continued. On to Outline 11 - Documenting Programs and Procedures.
Summary
We consider sipmle textual interactive programs, programs that read input from the user and produce output.
Related Pages
Overview
read-line.read.Administrivia
We expected something like the following.
(define cube (section expt <> 3))
Some of you tried to use *, but each <> is a separate input.
(define fave (irgb 250 0 42))
(irgb-complement fave)
> (irgb->string fave)
"250/0/42"
This problem was to remind you that irgb-complement does not change
fave. Rather, it computes a new color. That's similar to
(define num 5)
(square num)
> num
5
The behavior of irgb-complement and square contrasts a bit with the
kinds of procedures we're playing with today.
Problem 2b
(define fave (irgb 250 0 42))
(define fave2 (irgb-darker (irgb-lighter fave)))
> (irgb->string fave2)
"239/0/42"
An important point from the labs was that irgb-lighter and irgb-darker cap
when you reach the extreme values (0 and 255). So the red component of
(irgb-lighter fave) is 255. When you subtract 16, we end up with 239.
display to print values.newline to print a newline.display and newline, we can
better see what our program does.read-line.read.