4.3BSD/usr/contrib/icon/man/man2/image.2

.so tmac.ilib
.TH IMAGE 2 "The University of Arizona \- 6/28/83"
.SH NAME
Image \- generalized string image of Icon value
.SH SYNOPSIS
.nf
\*MImage(x)\fR
\*MImagex(x)\fR
.fi
.SH DESCRIPTION
The procedure \*MImage(x)\fR produces a string
image of the value \*Mx\fR. The value produced is a generalization of
the value produced by the Icon function \*Mimage(x)\fR, providing detailed
information about structures.
.PP
Tags are used to uniquely identify
structures. A tag consists of a letter identifying the type followed
by an integer. The tag letters are \*ML\fR for lists, \*MR\fR for
records, and \*MT\fR for tables. The first time a structure is encountered,
it is imaged as the tag followed by a colon, followed by a representation
of the structure. If the same structure is encountered again, only the
tag is given.
.PP
An example is
.DS
a := \^["x"]
push(a,\*ba)
t := table()
push(a,\*bt)
t\^[a] := t
t\^["x"] := \^[]
t\^[t] := a
write(Image(t))
.DE
which produces
.DS
T1:\^["x"\->L1:\^[],\*bL2:\^[T1,\*bL2,\*b"x"]\->T1,\*bT1\->L2]
.DE
Note that a table is represented as a list of entry and assigned
values separated by \*M\->\fRs.
.LP
The procedure \*MImagex(x)\fR is similar to \*MImage(x)\fR, except that
newlines and spaces are inserted to that the printed result is
displayed on multiple lines with indentation. There are other formatting
details that differ between the two procedures.
For the example given above, the result of
.DS
write(Imagex(t))
.DE
is
.DS
T1:{
   "x"
   \-\-\-
L1:[]
   ]
\-\-\-\-\-\-
L2:[
   T1
   L2
   "x"
   ]
\-\-\-
T1
\-\-\-\-\-\-
T1
\-\-\-
L2
\-\-\-\-\-\-
]
.DE
.SH AUTHOR
Ralph E. Griswold