summaryrefslogtreecommitdiffstats
path: root/recobj.scm
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:26 -0800
committerBryan Newbold <bnewbold@robocracy.org>2017-02-20 00:05:26 -0800
commitf24b9140d6f74804d5599ec225717d38ca443813 (patch)
tree0da952f1a5a7c0eacfc05c296766523e32c05fe2 /recobj.scm
parent8ffbc2df0fde83082610149d24e594c1cd879f4a (diff)
downloadslib-f24b9140d6f74804d5599ec225717d38ca443813.tar.gz
slib-f24b9140d6f74804d5599ec225717d38ca443813.zip
Import Upstream version 2c0upstream/2c0
Diffstat (limited to 'recobj.scm')
-rw-r--r--recobj.scm54
1 files changed, 0 insertions, 54 deletions
diff --git a/recobj.scm b/recobj.scm
deleted file mode 100644
index caf55a6..0000000
--- a/recobj.scm
+++ /dev/null
@@ -1,54 +0,0 @@
-;;; "recobj.scm" Records implemented as objects.
-;;;From: whumeniu@datap.ca (Wade Humeniuk)
-
-(require 'object)
-
-(define record-type-name (make-generic-method))
-(define record-accessor (make-generic-method))
-(define record-modifier (make-generic-method))
-(define record? (make-generic-predicate))
-(define record-constructor (make-generic-method))
-
-(define (make-record-type type-name field-names)
- (define self (make-object))
-
- (make-method! self record-type-name
- (lambda (self)
- type-name))
- (make-method! self record-accessor
- (lambda (self field-name)
- (let ((index (comlist:position field-name field-names)))
- (if (not index)
- (slib:error "record-accessor: invalid field-name argument."
- field-name))
- (lambda (obj)
- (record-accessor obj index)))))
-
- (make-method! self record-modifier
- (lambda (self field)
- (let ((index (comlist:position field field-names)))
- (if (not index)
- (slib:error "record-accessor: invalid field-name argument."
- field-name))
- (lambda (obj newval)
- (record-modifier obj index newval)))))
-
- (make-method! self record? (lambda (self) #t))
-
- (make-method! self record-constructor
- (lambda (class . field-values)
- (let ((values (apply vector field-values)))
- (define self (make-object))
- (make-method! self record-accessor
- (lambda (self index)
- (vector-ref values index)))
- (make-method! self record-modifier
- (lambda (self index newval)
- (vector-set! values index newval)))
- (make-method! self record-type-name
- (lambda (self) (record-type-name class)))
- self)))
- self)
-
-(provide 'record-object)
-(provide 'record) \ No newline at end of file