Go to the first, previous, next, last section, table of contents.


Structure Basics

This section describes the basic procedures for creating and accessing structures.

primitive: make-struct type tail-elts . inits
Create a new structure.

type must be a vtable structure (See section Vtables).

tail-elts must be a non-negative integer. If the layout specification indicated by type includes a tail-array, this is the number of elements allocated to that array.

The inits are optional arguments describing how successive fields of the structure should be initialized. Only fields with protection 'r' or 'w' can be initialized -- fields of protection 's' are automatically initialized to point to the new structure itself; fields of protection 'o' can not be initialized by Scheme programs.

primitive: struct? obj
Return #t iff obj is a structure object.

primitive: struct-ref struct n
primitive: struct-set! struct n value
Access (or modify) the nth field of struct.

If the field is of type 'p', then it can be set to an arbitrary value.

If the field is of type 'u', then it can only be set to a non-negative integer value small enough to fit in one machine word.


Go to the first, previous, next, last section, table of contents.