Fundamentals of CS I (CS151 2001S) : Outlines
[Current]
[Discussions]
[Glance]
[Honesty]
[Instructions]
[Links]
[News]
[Search]
[Syllabus]
Primary
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Quizzes]
[Readings]
[Reference]
Sets
[Blackboard]
[Scheme Report]
[SamR's Schedule]
[Rebelsky/Fall 2000]
[Walker/Fall2000]
[Stone/Spring2000]
Links
Reading: Vectors. Lab: Vectors. Back to Discussion of Exam 1. On to Pause for Breath.
Held Thursday, March 8, 2001
Summary
Today we consider vectors, which serve as alternates to lists. Vectors differ from lists in three primary ways: vectors have fixed size, vectors are indexed, and vectors are mutable.
Notes
You can't learn to ride a bike by watching someone else.
write
and
display
.
Overview
car
, cdr
,
null
, and null?
).
(vector val1 ... valn)
:
a lot like list
(make-vector size element)
:
make a vector of a particular length containing lots
of copies of the same value.
(vector? value)
: determine if a
value is a vector
(vector-length vector)
: get the
length of a vector
(vector-ref vector pos)
: get
an element from a vector.
(vector-set! vector pos newval)
:
change part of a vector. Note the use of an exclamation point
to indicate that this changes its argument.
(list->vector list)
: Guess
(vector->list vector)
: Guess
(vector-fill! vector value)
: Fill
an existing vector with a particular value.
Friday, 12 January 2001
Thursday, 8 March 2001
Back to Discussion of Exam 1. On to Pause for Breath.
[Current]
[Discussions]
[Glance]
[Honesty]
[Instructions]
[Links]
[News]
[Search]
[Syllabus]
Primary
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Quizzes]
[Readings]
[Reference]
Sets
[Blackboard]
[Scheme Report]
[SamR's Schedule]
[Rebelsky/Fall 2000]
[Walker/Fall2000]
[Stone/Spring2000]
Links
Disclaimer: I usually create these pages on the fly. This means that they are rarely proofread and may contain bad grammar and incorrect details. It also means that I may update them regularly (see the history for more details). Feel free to contact me with any suggestions for changes.
This page was generated by Siteweaver on Wed May 5 12:15:00 2004.
This page may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2001S/outline.27.html
.
You may validate
this page's HTML.
The source was last modified Thu Mar 8 08:31:13 2001.