aboutsummaryrefslogtreecommitdiff
path: root/weeb
diff options
context:
space:
mode:
authorJakob L. Kreuze2026-06-04 07:19:29 -0400
committerJakob L. Kreuze2026-06-04 07:19:29 -0400
commitb747932a138f184cbf85420130efcb50a6fe3f7b (patch)
tree930f54d29d0d95c786b5feb907b64311b00c84fa /weeb
parentedc7760fd02664bda09d25f31b77b325dfe91d8a (diff)
Predicate wrapper
Diffstat (limited to 'weeb')
-rw-r--r--weeb/struct.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/weeb/struct.scm b/weeb/struct.scm
index 64349ef..65fa2ab 100644
--- a/weeb/struct.scm
+++ b/weeb/struct.scm
@@ -20,6 +20,7 @@
#:use-module (ice-9 regex)
#:export (define-struct
make-struct
+ instance-of?
with-accessors
call-with-slots))
@@ -40,6 +41,10 @@
instantiate the record's fields."
(apply (record-constructor type) args))
+(define (instance-of? type rtd)
+ "Returns true if RTD is an instance of TYPE."
+ ((record-predicate type) rtd))
+
;; Bind the accessors for the fields of the record RTD to local
;; variables in BODY. RTD must be a record type descriptor.
(define-syntax with-accessors

© 2015 - 2026 Jakob L. Kreuze