Functional Problem Solving (CSC 151 2015F) : EBoards

CSC151.02 2015F, Class 23: Revisiting Lists


Overview

Preliminaries

Admin

Upcoming Work

Extra Credit Opportunities

Academic

Other Good Things

Questions

When I'm picking the random column and row, what range should I choose from?

For the column, it should be a number between left and left+width-1.

But random only gives me a value between 0 and n-1.

Think about how to transform one range to another. (Hint: Addition.)

Do I need to document the procedures in part 3?

Yes. But you can use just 4P's.

Lab

No Lab Writeup Today!

Lesson 1: You can only take the car of non-empty lists and things created with cons.

Lesson 2: You can only use up to four middle letters in the silly cddddr procedures.

Lesson 3: Computer scientists often start numbering at 0, rather than 1. That's somewhat nice for how we write procedurees, since to get element 5 of a list, we have to call cdr 5 times.

Lesson 4: Scheme lets you create things that aren't lists. These things show up with a dot in the middle. Be careful when you have such things; they will sometimes, but not always, lead to errors when you use them like lists.

    > (cons 1 (cons 2 3))
    > (append (iota 50) 1)

Lesson 5: car and cdr work with the "not quite list" things. They are officially defined with the rules

    (car (cons a b)) = a
    (cdr (cons a b)) = b

Note 6: For problem 5, consider

    (cons 'drawing (cons 'rectangle (cddr drawing)))