Functional Problem Solving (CSC 151 2016S) : Outlines

Outline 38: Vectors


Held: Tuesday, 12 April 2016

Back to Outline 37 - Pairs and Pair Structures. On to Outline 39 - Pause for Breath.

Summary

We consider vectors, an alternative to lists for storing collections of data.

Related Pages

Overview

Administrivia

Reminders

Upcoming Work:

Extra Credit

Academic / Artistic

Peer

Miscellaneous

Regular Peer

Misc

Far in the Future

Questions

What was yesterday's writeup?

Exercise 3.

What should rac and rcd return when given null as input?

What do car and cdr return when given null as input?

What's wrong with my stencil procedure?

Most common answer: You don't have to fit everything into one let or letrec. You can nest forms of let.

Second most common answer: You need to recompute the random column and row at each repetition. Think about your ordering of operations.

Can you demo image-set-pixel!?

Sure.

Can you explain the formula for problem 6?

The area of a circle is pirr. If the radius is 1, the area of a circle is pi. If it's a quarter circle, the area is pi/4. We're approximating the area of the quarter circle. We can then run the formula backwards to get pi.

_I've written irgb-closest using that "doubly recursive method" which we've seen is horribly inefficient. Will you penalize us for that?

Yes. Lots! (If I'm in a good mood when grading, and you have nothing else wrong with your solution, you'll be lucky to get a 6/10 on that problem.)

Data Types

List Deficiencies

An Alternative: Vectors

Implementing Vectors

Lab