Fundamentals of CS I (CS151 2002F)
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
Back to Insertion Sort. On to Merge Sort.
Held Wednesday, November 27, 2002
Summary
Today we pause to reflect on some of the more difficult problems we've worked on recently and to consider the examination.
Due
Assignments
Notes
Overview
assoc procedure can
return an entry from the association list or #f.
assoc-all
procedure (that returns a list of all the matching entries)
to return #f when there are no matching entires.
assoc-all, in which you're supposed
to return a list of all the matching entries, it seems natural
to me to return the empty list when nothing matches, since that
list contains all the matching entries.
(define assoc-all
(lambda (key database)
; Nothing can be in the empty database, so return false.
(if (null? database)
#f
; If we match the car of the database, look in the rest.
(if (equal? key (caar database)
; If the key does not appear any more in the database
; make a list of just the one value we've seen
(if (not (assoc-all key (cdr database)))
(list (car database))
; Otherwise, attach the matched entry to
; the remaining matched entries
(cons (car database) (assoc-all key (cdr database))))
; We didn't match the car, so just look in the rest
(assoc-all key (cdr database)))))))
Thursday, 29 August 2002 [Samuel A. Rebelsky]
Tuesday, 26 November 2002 [Samuel A. Rebelsky]
Monday, 2 December 2002 [Samuel A. Rebelsky]
Back to Insertion Sort. On to Merge Sort.
Primary:
[Skip To Body]
[Front Door]
[Current]
[Glance]
[Honesty]
[Instructions]
[Links]
[Search]
[Syllabus]
Groupings:
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
ECA:
[About]
[Grades]
[Quizzes]
[Submit Work]
[Change Password]
[Reset Password]
Miscellaenous:
[Scheme Reference]
[CS151 2002F Gum]
[CS151 2001S]
[SamR]
[Glimmer Labs]
[schemers.org]
Disclaimer:
I usually create these pages on the fly
, which means that I rarely
proofread them and they may contain bad grammar and incorrect details.
It also means that I tend to update them regularly (see the history for
more details). Feel free to contact me with any suggestions for changes.
This document was generated by
Siteweaver on Mon Dec 2 08:42:09 2002.
The source to the document was last modified on Mon Dec 2 08:33:34 2002.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2002F/Outlines/outline.48.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby