► |  | Reference: PLT Scheme

1 | Language Model
2 | Syntactic Forms
3 | Datatypes
4 | Structures
5 | Classes and Objects
6 | Units
7 | Contracts
8 | Pattern Matching
9 | Control Flow
10 | Concurrency
11 | Macros
12 | Input and Output
13 | Reflection and Security
14 | Operating System
15 | Memory Management
16 | Unsafe Operations
17 | Running PLT Scheme
| Bibliography
| Index

▼ | 3 | Datatypes

3.1 | Booleans and Equality
3.2 | Numbers
3.3 | Strings
3.4 | Byte Strings
3.5 | Characters
3.6 | Symbols
3.7 | Regular Expressions
3.8 | Keywords
3.9 | Pairs and Lists
3.10 | Mutable Pairs and Lists
3.11 | Vectors
3.12 | Boxes
3.13 | Hash Tables
3.14 | Sequences
3.15 | Dictionaries
3.16 | Procedures
3.17 | Void and Undefined

On this page:

box?
box
box-immutable
unbox
set-box!

top← prev up next →

#### 3.12`` Boxes

> > > Boxes in Guide: PLT Scheme introduces boxes.

A box is like a single-element vector, normally used as minimal mutable storage.

(box? v) → boolean?
v : any/c

Returns #t if v is a box, #f otherwise.

(box v) → box?
v : any/c

Returns a new mutable box that contains v.

(box-immutable v) → (and/c box? immutable?)
v : any/c

Returns a new immutable box that contains v.

(unbox box) → any/c
box : box?

Returns the content of box.

For any v, (unbox (box v)) returns v.

(set-box! box v) → void?
box : (and/c box? (not/c immutable?))
v : any/c

Sets the content of box to v.
top← prev up next →