Functional Problem Solving (CSC 151 2014S) : EBoards

CSC151.02 2014S, Class 29: Pause for Breath


Overview

Preliminaries

Upcoming work

Admin

Questions on the exam

Can I assume that the values in the list for nearest are in ascending order?

No.

If I write a helper for nearest can I have more than two parameters for that helper?

Yes. You'll probably need more than two.

Do I need to document my helpers?

A one-line piece of documentation will suffice. (You'll think about it better writing the six P's, but it's not necessary.)

How can I not die on the nearest procedure?

We've written similar procedures before. So look through the readings and identify an appropriate pattern. nearest is looking for the "best" of a set of values. drawings-leftmost and irgb-brightest do the same.

Can I ask Kim the mentor for help on the exam?

Given that last response, it seems risky. But no, you may not ask Kim for direct help. You can, however, ask her to explain things from past readings and lab. "Kim, I don't understand drawings-leftmost. Can you explain how it works?" You also can't ask Kim your colleague.

Let's run through an example by hand?

(nearest 29 (list 19 4 64 1 32 11))

  value     best-so-far     remaining

  29        19              '(4 64 1 32 11)
  29        19              '(64 1 32 11)
  29        19              '(1 32 11)
  29        19              '(32 11)
  29        32              '(11)
  29        32              '()

What's a unit of text?

A function name, parameter, value, or keyword.

On problem 3, when we're flattening without conditionals, can we use procedures that you didn't give in the hint?

Yes. You'll probably need +, -, *, or /.

Can you give me another hint on question 3?

Sure: 0 = 064, 64 = 164, 128 = 264, 192 = 364 and 256 = 4*64.

So think about turning ranges into the multipliers.


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.