chickadee » chicken » memory » representation » make-record-instance

make-record-instance SYMBOL ARG1 ...procedure

Returns a new instance of the record type SYMBOL, with its slots initialized to ARG1 .... To illustrate:

(define-record-type point (make-point x y) point?
  (x point-x point-x-set!)
  (y point-y point-y-set!))

expands into something quite similar to:

(begin
  (define (make-point x y)
    (make-record-instance 'point x y) )
  (define (point? x)
    (and (record-instance? x)
         (eq? 'point (block-ref x 0)) ) )
  (define (point-x p) (block-ref p 1))
  (define (point-x-set! p x) (block-set! p 1 x))
  (define (point-y p) (block-ref p 2))
  (define (point-y-set! p y) (block-set! p 1 y)) )