record-predicate(3scm) Scheme Programmer's Manual record-predicate(3scm)

record-predicate - create record predicates

(import (rnrs))                     ;R6RS
(import (rnrs records procedural))  ;R6RS

(record-predicate rtd)

Returns a procedure that, given an object obj, returns #t if obj is a record of the type represented by rtd, and #f otherwise.

Returns a single value; a procedure.

(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

These procedures are used together with the procedural record layer.

This procedure is unique to the R6RS record system. An equivalent procedure can be found in SRFI-237.

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.

record-accessor(3scm), make-record-type-descriptor(3scm), define-record-type(3scm)

R6RS

First appeared in R6RS as part of the new record system.

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