Fundamentals of Computer Science I (CS151 2003F)
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Guidelines for Lab Writeups]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Scheme Report]
[Glimmer Scheme Reference]
[CSC151.01 (Gum)]
[CSC151 2003S]
[CSC151 2002F]
[SamR]
Back to Project: A Simple CGI Application. On to Object Basics.
Held: Tuesday, 2 December 2003
Summary: Today we consider how to build records in Scheme. Records group data and permit access to those data by name.
Related Pages:
Assignments
Notes:
Overview:
entry.
type
Student = record
firstName: string;
lastName: string;
grade: real;
end;
(define student
(lambda (lname fname gpa)
(vector 'student lname fname gpa)))
(define student-lastname
(lambda (student)
(if (not (eq? (vector-ref student 0) 'student))
(error "Not a student")
(vector-ref student 1))))
(define produce-type-mark
(let ((type-mark (list 'compound)))
(lambda () type-mark)))
let creates a new symbol table with one
entry whose name is type-mark and whose value
is (compound).
lambda gets that value.
compound will be
equal? to the type mark, but not
eq?.
Back to Project: A Simple CGI Application. On to Object Basics.
[Skip to Body]
Primary:
[Front Door]
[Current]
[Glance]
-
[Honesty]
[Instructions]
[Links]
[Guidelines for Lab Writeups]
Groupings:
[EBoards]
[Examples]
[Exams]
[Handouts]
[Homework]
[Labs]
[Outlines]
[Readings]
[Reference]
Misc:
[Scheme Report]
[Glimmer Scheme Reference]
[CSC151.01 (Gum)]
[CSC151 2003S]
[CSC151 2002F]
[SamR]
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 Tue Dec 9 14:00:01 2003.
The source to the document was last modified on Mon Sep 1 13:30:51 2003.
This document may be found at http://www.cs.grinnell.edu/~rebelsky/Courses/CS151/2003F/Outlines/outline.50.html.
You may wish to
validate this document's HTML
;
;
Check with Bobby