summaryrefslogtreecommitdiffstats
path: root/record.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:29 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:29 -0800
commit8466d8cfa486fb30d1755c4261b781135083787b (patch)
treec8c12c67246f543c3cc4f64d1c07e003cb1d45ae /record.scm
parent87b82b5822ca54228cfa6df29be3ad9d4bc47d16 (diff)
downloadslib-8466d8cfa486fb30d1755c4261b781135083787b.tar.gz
slib-8466d8cfa486fb30d1755c4261b781135083787b.zip
Import Upstream version 3a1upstream/3a1
Diffstat (limited to 'record.scm')
-rw-r--r--record.scm27
1 files changed, 16 insertions, 11 deletions
diff --git a/record.scm b/record.scm
index 9f80045..3935aef 100644
--- a/record.scm
+++ b/record.scm
@@ -1,6 +1,6 @@
; "record.scm" record data types
; Written by David Carlton, carlton@husc.harvard.edu.
-; Re-Written by Aubrey Jaffer, jaffer@ai.mit.edu, 1996, 1997
+; Re-Written by Aubrey Jaffer, agj @ alum.mit.edu, 1996, 1997
;
; This code is in the public domain.
@@ -22,14 +22,19 @@
(define vector->list vector->list)
(define display display)
(define write write)
-
+;@
(define record-modifier #f)
(define record-accessor #f)
(define record-constructor #f)
(define record-predicate #f)
(define make-record-type #f)
-(let (;; Need to close these to keep magic-cookie hidden.
+(let (;; protect CL functions against redefinition.
+ (has-duplicates? has-duplicates?)
+ (notevery notevery)
+ (position position)
+
+ ;; Need to close these to keep magic-cookie hidden.
(make-vect make-vector)
(vect vector)
@@ -89,8 +94,8 @@
(if (not (or (symbol? type-name) (string? type-name)))
(slib:error 'make-record-type "non-string type-name argument."
type-name))
- (if (or (and (list? field-names) (comlist:has-duplicates? field-names))
- (comlist:notevery symbol? field-names))
+ (if (or (and (list? field-names) (has-duplicates? field-names))
+ (notevery symbol? field-names))
(slib:error 'make-record-type "illegal field-names argument."
field-names))
(let* ((augmented-length (+ 1 (length field-names)))
@@ -136,15 +141,15 @@
(let ((rec-vfields (rtd-vfields rtd))
(corrected-rec-length (rtd-length rtd))
(field-names (car field-names)))
- (if (or (and (list? field-names) (comlist:has-duplicates? field-names))
- (comlist:notevery (lambda (x) (memq x rec-vfields))
+ (if (or (and (list? field-names) (has-duplicates? field-names))
+ (notevery (lambda (x) (memq x rec-vfields))
field-names))
(slib:error
'record-constructor "invalid field-names argument."
(cdr rec-vfields)))
(let ((field-length (length field-names))
(offsets
- (map (lambda (field) (comlist:position field rec-vfields))
+ (map (lambda (field) (position field rec-vfields))
field-names)))
(lambda elts
(if (= (length elts) field-length) #t
@@ -163,7 +168,7 @@
(lambda (rtd field-name)
(if (not (rtd? rtd))
(slib:error 'record-accessor "invalid rtd argument." rtd))
- (let ((index (comlist:position field-name (rtd-vfields rtd)))
+ (let ((index (position field-name (rtd-vfields rtd)))
(augmented-length (rtd-length rtd)))
(if (not index)
(slib:error 'record-accessor "invalid field-name argument."
@@ -180,7 +185,7 @@
(lambda (rtd field-name)
(if (not (rtd? rtd))
(slib:error 'record-modifier "invalid rtd argument." rtd))
- (let ((index (comlist:position field-name (rtd-vfields rtd)))
+ (let ((index (position field-name (rtd-vfields rtd)))
(augmented-length (rtd-length rtd)))
(if (not index)
(slib:error 'record-modifier "invalid field-name argument."
@@ -209,7 +214,7 @@
(cond ((rec? vct) (vec:error 'vector-set! nvt vct))
(else (vect-set! vct k obj)))))
(set! vector-fill!
- (lambda (vector fill)
+ (lambda (vct fill)
(cond ((rec? vct)
(vec:error 'vector-fill! nvt vct))
(else (vect-fill! vct fill)))))