Functional Problem Solving (CSC 151 2015F) : EBoards
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)]
Overview
map, for-each, repeat, and recursion.For part D, I want to share a really good hint with my classmates. Is that okay?
Yes.
For part A2, if we vary the length of the line, what should we keep constant?
The angle.
For part A2, can we allow the user to supply other parameters?
You may allow the user to supply other parameters, or you can choose them yourself. The kernel can also keep track of more things. (E.g., the current red, green, and blue component).
For part A2, what is systematic but not constant?
Examples: Separate by 0, 1, 2, 3, 4, 5, 6, 7, ...; - gives 0, 1, 3, 6, 10, 15, 21, ...; Separate by 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, ....
For part D, what do you expect in terms of what it should do?
A procedure that takes some information about where the recursive part should go and what size it is (and what angle it is).
When we have two choices and want to do multiple things in each case, what should we use?
You can't use an
if, because it requires only one thing. You can't use awhen, because you have two choices. Hence, use acond.
(cond
[(test?)
(thing1)
(thing2)
(thing3)]
[else
(cat)
(hat)
(bat)])
Or the following thing that CC would never write. The
condis prettier.
(if (test?)
(let ()
(thing1)
(thing2)
(thing3))
(let ()
(cat)
(hat)
(bat)))
For the recursive image, should we assume that the entire image is being recursed or only sections.
It's much harder if you aren't keeping the whole image. So you can try it, but it will be difficult.
map, for-each, repeat, and recursionmap:
for-each:
repeat:
recursion:
Try using the brush "2. Hardness 100" with a size of 0.25 or so.
(turtle-set-brush! turtle "2. Hardness 100" 0.25)
Writeup 1c