refactor vm application of non-programs; boot continuation refactor
[bpt/guile.git] / examples / box / README
CommitLineData
673509f8
MG
1 -*- outline -*-
2
3* Overview
2de7ddb7
MG
4
5This directory includes an example program for extending Guile with a
6new (and even useful) data type.
7
673509f8
MG
8
9* Build Instructions
10
2de7ddb7
MG
11To build the example, simply type
12
13 make box
14
15in this directory.
16
17The resulting `box' program is a Guile interpreter which has one
18additional data type called `box'.
19
673509f8
MG
20
21* The Box Data Type
22
2de7ddb7
MG
23A box is simply an object for storing one other object in. It can be
24used for passing parameters by reference, for example. You simply
25store an object into a box, pass it to another procedure which can
26store a new object into it and thus return a value via the box.
27
673509f8
MG
28
29** Usage
30
2de7ddb7
MG
31Box objects are created with `make-box', set with `box-set!' and
32examined with `box-ref'. See the following example session for usage
33details:
34
673509f8
MG
35
36** Example Session
37
2de7ddb7
MG
38$ ./box
39guile> (define b (make-box))
40guile> b
41#<box #f>
42guile> (box-set! b '(list of values))
43guile> b
44#<box (list of values)>
45guile> (box-ref b)
46(list of values)
47guile> (quit)
48$