GNU Info

Info Node: (guile.info)Structure Basics

(guile.info)Structure Basics


Next: Vtables Prev: Structure Layout Up: Structures
Enter node , (file) or (file)node

Structure Basics
----------------

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

 - primitive: make-struct vtable tail_array_size . init
     Create a new structure.

     TYPE must be a vtable structure (Note: 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 INIT1, ... are optional arguments describing how successive
     fields of the structure should be initialized.  Only fields with
     protection 'r' or 'w' can be initialized, except for fields of
     type 's', which are automatically initialized to point to the new
     structure itself; fields with protection 'o' can not be
     initialized by Scheme programs.

     If fewer optional arguments than initializable fields are supplied,
     fields of type 'p' get default value #f while fields of type 'u'
     are initialized to 0.

     Structs are currently the basic representation for record-like data
     structures in Guile.  The plan is to eventually replace them with a
     new representation which will at the same time be easier to use and
     more powerful.

     For more information, see the documentation for
     `make-vtable-vtable'.

 - primitive: struct? x
     Return #t iff OBJ is a structure object, else #f.

 - primitive: struct-ref handle pos
 - 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.


automatically generated by info2www version 1.2.2.9