3 This directory includes an example program for extending Guile with a
4 new (and even useful) data type.
6 The `box' program created by this example is nearly identical to the
7 one produced in directory ../box, with one (important) difference: The
8 interpreter in this directory will place all defined primitive
9 procedures in a module called (box-module). That means that this
10 module must be used before the primitives can be accessed.
12 To build the example, simply type
18 The resulting `box' program is a Guile interpreter which has one
19 additional data type called `box'.
21 A box is simply an object for storing one other object in. It can be
22 used for passing parameters by reference, for example. You simply
23 store an object into a box, pass it to another procedure which can
24 store a new object into it and thus return a value via the box.
26 Box objects are created with `make-box', set with `box-set!' and
27 examined with `box-ref'. Note that these procedures are placed in a
28 module called (box-module) and can thus only be accessed after using
29 this module. See the following example session for usage details:
32 guile> (use-modules (box-module))
33 guile> (define b (make-box))
36 guile> (box-set! b '(list of values))
38 #<box (list of values)>