record-rtd(3scm)
π NAME π
record-rtd(3scm) β get the rtd for the type of a record. Bestie, this is from the Scheme Programmer's Manual, and it's literally about peeking at a record's type descriptor. π
πΈ LIBRARY πΈ
(import (rnrs)) ;R6RS
(import (rnrs records inspection)) ;R6RS
β¨ SYNOPSIS β¨
(record-rtd record)
π DESCRIPTION π
So this returns the rtd representing the type of record β but only if the type is not opaque. π
You get the rtd of the most precise type, meaning the type t such that record is of type t but not of any type that extends t. Periodt.
π§ IMPLEMENTATION NOTES π§
Ngl, most R6RS implementations define enumerations in terms of records. π
π¦ RETURN VALUES π¦
Returns a single value; an rtd. That's it, that's the whole vibe check. β¨
π EXAMPLES π
(define rtd-user
(make-record-type-descriptor
'user #f #f #f #f
'#((immutable login) (immutable realname))))
(define rcd-user
(make-record-constructor-descriptor
rtd-user #f
(lambda (p)
(lambda (login realname)
(p login realname)))))
(define make-user (record-constructor rcd-user))
(define lain (make-user 'lain "Lain Iwakura"))
(eqv? (record-rtd lain) rtd-user) => #t
π APPLICATION USAGE π
This procedure is an important part of the record inspection functionality, and it can be used to implement record printers, pattern matchers with record support, and other functionality that requires information about record types. It's giving very useful, honestly. π«Ά
π COMPATIBILITY π
This procedure is unique to the R6RS record system. An equivalent procedure can be found in SRFI-237. π
Implementations often use records to define new types β even types that are not required to use records for their internal representation. There is generally no guarantee that you can use record-rtd on these types, and doing so is not portable. So likeβ¦ don't just assume, bestie. π
π₯ ERRORS π₯
This procedure can raise exceptions with the following condition types:
&assertion(R6RS) β the wrong number of arguments was passed or an argument was outside its domain. In particular,recordmust be a record. This is also raised if the type ofrecordis opaque. π
π SEE ALSO π
β STANDARDS β
R6RS. Iconic behavior. β¨
π HISTORY π
This procedure first appeared in R6RS as part of the record system. A whole main-character origin story. π
πΈ AUTHORS πΈ
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://github.com/schemedoc/manpages/. π«Ά
π okay that's the whole page, bestie! Source/version: the Scheme Programmer's Manual, page record-rtd(3scm), dated 2023-08-15. periodt. π
π¦ where this page comes from
- nixpkgs unstable: scheme-manpages 0-unstable-2024-02-11
- π the page's license: MIT
- Copyright (c) 2023 Gwen Weinholt
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms