* box-dynamic-module: New directory, implements the box type in a
[bpt/guile.git] / examples / box / README
1 -*- text -*-
2
3 This directory includes an example program for extending Guile with a
4 new (and even useful) data type.
5
6 To build the example, simply type
7
8 make box
9
10 in this directory.
11
12 The resulting `box' program is a Guile interpreter which has one
13 additional data type called `box'.
14
15 A box is simply an object for storing one other object in. It can be
16 used for passing parameters by reference, for example. You simply
17 store an object into a box, pass it to another procedure which can
18 store a new object into it and thus return a value via the box.
19
20 Box objects are created with `make-box', set with `box-set!' and
21 examined with `box-ref'. See the following example session for usage
22 details:
23
24 $ ./box
25 guile> (define b (make-box))
26 guile> b
27 #<box #f>
28 guile> (box-set! b '(list of values))
29 guile> b
30 #<box (list of values)>
31 guile> (box-ref b)
32 (list of values)
33 guile> (quit)
34 $