diff options
author | Andy Wingo <wingo@pobox.com> | 2019-10-29 10:34:35 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-10-29 10:34:35 +0100 |
commit | 1ae0f8d49043cc8c7bc4a31966ea078747edd490 (patch) | |
tree | fb31750fa6f6a415d23b48a798ebbb202ffd4548 | |
parent | 315fabdfe7122737ca9a804097ff16dabfd7a63a (diff) | |
download | guile-1ae0f8d49043cc8c7bc4a31966ea078747edd490.tar.gz |
Add record-type-parent definition.
* module/ice-9/boot-9.scm (record-type-parent): New definition.
-rw-r--r-- | module/ice-9/boot-9.scm | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index d310a13cf..db21c699c 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -1234,6 +1234,11 @@ VALUE." (unless (record-type? rtd) (error 'not-a-record-type rtd)) (struct-ref rtd (+ 4 vtable-offset-user))) +(define (record-type-parent rtd) + (let* ((parents (record-type-parents rtd)) + (nparents (vector-length parents))) + (and (not (zero? nparents)) + (vector-ref parents (1- nparents))))) (define (record-type-mutable-fields rtd) (unless (record-type? rtd) |