| record-predicate(3scm) | Scheme Programmer's Manual | record-predicate(3scm) |
NAME
record-predicate - create record predicates
LIBRARY
(import (rnrs)) ;R6RS (import (rnrs records procedural)) ;R6RS
SYNOPSIS
(record-predicate rtd)
DESCRIPTION
Returns a procedure that, given an object obj, returns #t if obj is a record of the type represented by rtd, and #f otherwise.
RETURN VALUES
Returns a single value; a procedure.
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 user? (record-predicate rtd-user))
(define lain (make-user 'lain "Lain Iwakura"))
(user? lain) => #t
APPLICATION USAGE
These procedures are used together with the procedural record layer.
COMPATIBILITY
This procedure is unique to the R6RS record system. An equivalent procedure can be found in SRFI-237.
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, rtd must be a record-type descriptor.
SEE ALSO
record-accessor(3scm), make-record-type-descriptor(3scm), define-record-type(3scm)
STANDARDS
R6RS
HISTORY
First appeared in R6RS as part of the new record system.
AUTHORS
This page is part of the scheme-manpages project. It includes materials from the RnRS documents. More information can be found at https://weinholt.se/scheme/manpages/.
| 2023-08-05 |