<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//en">

<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of Typesetting Arrays</TITLE>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">

<LINK REL="STYLESHEET" HREF="apl_tug.css">

<LINK REL="next" HREF="node6_mn.html"> <LINK REL="previous" HREF="node4_mn.html"> <LINK REL="up" HREF="node4_mn.html"> <LINK REL="next" HREF="node6_mn.html"> </HEAD>

<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">

<H2><A ID="SECTION00041000000000000000"> Typesetting <IMG STYLE="height: 39.24ex; vertical-align: 139.30ex; " SRC="img1.png" ALT="APL"> Arrays</A> </H2>

<P> The interpreter usually displays arrays as text matrices on the screen. For example, the matrix <IMG STYLE="height: 1.96ex; vertical-align: 177.20ex; " SRC="img6.png" ALT="$\APLX$"> is displayed as:

<P> <BR> <IMG STYLE="height: 1.61ex; vertical-align: 176.86ex; " SRC="img7.png" ALT="
\begin{APLarray}
\leavevmode\hbox to 1.2em{\hss\APLspace\hss}\leavevmode\hbox to...
....space\hss\leavevmode\hbox to 1.2em{\hss
\APLC\hss}
\APLspace\par
\end{APLarray}
"> <BR>

<P> The above printout is typeset by the following code which is automatically produced by the <I>APL</I> front end:

<P> <PRE>
\begin{APLarray}
\APLmb{\APLspace}\APLmb{\APLone}
\APLmb{\APLspace}\APLmb{\APLtw...
...APLmb{\APLspace}
\APLmb{\APLspace}\APLmb{\APLA}
\APLspace\par
...
\end{APLarray}
</PRE>

<P> Note that the structure of <IMG STYLE="height: 1.96ex; vertical-align: 177.20ex; " SRC="img6.png" ALT="$\APLX$"> has been preserved by automatically enforcing fixed spacing. A closer examination of the code reveals that we have simulated fixed spacing by boxing each character of the array (<code></code> does this).

<P> Experienced <I>APL</I> programmers recognize the structure of <IMG STYLE="height: 1.96ex; vertical-align: 177.20ex; " SRC="img6.png" ALT="$\APLX$"> at the first glance: <IMG STYLE="height: 1.96ex; vertical-align: 177.20ex; " SRC="img6.png" ALT="$\APLX$"> is a two by two matrix whose upper left element is a two by two matrix. However, since the use of nested arrays is typical for second generation <I>APL</I>s like <I>APL</I>2 and Dyalog <I>APL</I>, another representation of arrays exists which shows the structure in a more explicit manner:

<P> <I> <BR> <IMG STYLE="height: 1.75ex; vertical-align: 176.37ex; " SRC="img8.png" ALT="
\begin{APLarray}
\leavevmode\hbox to 1.2em{\hss\APLdot\hss}\leavevmode\hbox to 1...
....ar\hss\leavevmode\hbox to 1.2em{\hss\APLquote\hss}
\APLspace\par
\end{APLarray}
"> <BR></I>

<P> Most of the work for typesetting the boxed representation of <IMG STYLE="height: 1.96ex; vertical-align: 177.20ex; " SRC="img6.png" ALT="$\APLX$"> shown above is done by the <I>APL</I> function which usually comes with the <I>APL</I> system (e.g. [<A HREF="node11_ct.html#IBM" TARGET="contents">IBM 85</A>]). Our <I>APL</I> front end just translates the characters generated by this function; the same L<SUP><SMALL>A</SMALL></SUP>T<SMALL>E</SMALL>X environment is used for both array representations. We only sketch the code for the boxed representation:

<P> <PRE>
\begin{APLarray}
\APLmb{\APLdot}\APLmb{\APLrightarrow}
\APLmb{\APLbar}\APLmb{\APLbar}
...
\end{APLarray}
</PRE>

<P> In order to demonstrate the ease of changing type styles we have decided to put the generated code unit into an <I>italics</I> environment. This is the reason for all letters and numbers in the boxed representation being in <I>italics</I>. Otherwise, they would have been roman.

<P>

<HR>

</BODY> </HTML>