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.
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)))
letcreates a new symbol table with one entry whose name is
type-markand whose value is
lambdagets that value.
equal?to the type mark, but not
Thursday, 28 August 2003 [Samuel A. Rebelsky]
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