1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222
|
<HTML>
<HEAD>
<TITLE>A+ Reference: Overview of A+</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<A NAME=HEADING16>
<H1><FONT color="#FF0000">Overview <A NAME=0>of A+</FONT></H1>
<a name="CONTENTS2">
<UL>
<A HREF="#HEADING17"> Summary of the A+ Programming Language</A><BR>
<A HREF="#HEADING18"> Some Features of the A+ Language</A><BR>
<UL>
<A HREF="#HEADING19"> Leading Axis Operations</A><BR>
<A HREF="#HEADING20"> Rank Operator</A><BR>
<A HREF="#HEADING21"> Mapped Files</A><BR>
<A HREF="#HEADING22"> Screens and Workspaces</A><BR>
<A HREF="#HEADING23"> Callbacks</A><BR>
<A HREF="#HEADING24"> Dependencies</A><BR>
<A HREF="#HEADING25"> Contexts </A><BR>
</UL>
<A HREF="#HEADING26"> Some Features of the A+ System</A><BR>
<UL>
<A HREF="#HEADING27"> Unix and Linux Environments</A><BR>
<A HREF="#HEADING28"> Emacs Programming Development Environment</A><BR>
</UL>
<A HREF="#HEADING29"> Applications</A><BR>
<UL>
<A HREF="#HEADING30"> Script Files</A><BR>
</UL>
<A HREF="#HEADING31"> The A+ Keyboard</A><BR>
</UL>
<HR>
<A NAME=HEADING17>
<H1><FONT color="#20B2AA">Summary of the A+ Programming Language</FONT></H1>
<blockquote>
A+ is an array-oriented programming language that provides<P>
<UL>
<LI>a rich set of primitive functions that act efficiently on arrays
<LI>general operators that control the ways functions are applied to arrays.
</UL>
In A+, the ordinary concept of arrays has been enhanced to provide<P>
<UL>
<LI>a means by which files can be treated as ordinary arrays
<LI>a variety of simple, straightforward ways of displaying and editing data on a screen,
with automatic synchronization between displayed data and the contents of variables
<LI>generalized, spreadsheet-like interactions among variables.
</UL>
These features are realized in A+ by furnishing global variables with<P>
<UL>
<LI>the attribute of being specific to one A+ process or more generally accessible
<LI>visual attributes such as font and color, analogous to the ordinary attributes of shape and type
<LI>asynchronous execution of functions that have been associated with variables and events
<LI>definitions describing the spreadsheet-like relations among their values.
</UL>
<A NAME=2>Global variables with associated definitions involving other global variables are
called <i>dependencies</i>. The values for an interrelated set of dependencies are
automatically kept as current as needed: if an object changes, any variable that is
dependent upon it is recalculated just before the next use of that dependent variable.
Although these spreadsheet-like relations are not new in principle, the definitions on which
they are based can employ the full A+ programming language. In particular, the spreadsheet
concept of a cell is not restricted to a scalar in A+, but can be any array, so that much
more data can be managed by these relations than is usual for spreadsheets, and more
efficiently. Similarly, the spreadsheet paradigm is not limited to numeric relations. For
example, the concept of a view in a relational database can be realized as a dependency on
the source data.<P>
Other A+ features are<P>
<UL>
<LI>conventional control structures
<LI>contexts, or separate namespaces, in a single workspace
<LI>dynamic linking of C functions, which can be called like ordinary A+ defined functions
<LI>a Unix operating system environment
<LI>an Emacs-based application development environment
<LI>asynchronous communication between processes, based on A+ arrays.
</UL>
</blockquote>
<A NAME=HEADING18>
<H1><FONT color="#20B2AA">Some Features of the A+ Language</FONT></H1>
<blockquote>
The primitive functions of A+, a variant of APL, can be classified as scalar, structural, or
specialized. A scalar primitive is applied independently to the individual elements of its
array arguments, but syntactically it can be applied to an entire array, providing a very
efficient implicit control structure. The scalar primitives include the ordinary arithmetic
functions, comparison functions, logical functions, and certain other mathematical
functions. A structural primitive is one that can be defined completely in terms of the
indices of its right argument: it rearranges or selects the elements of that argument but
otherwise leaves them unmodified. The specialized primitive functions include, for example,
ones for sorting arrays and inverting matrices.
</blockquote>
<A NAME=HEADING19>
<H2><FONT color="#20B2AA"> Leading Axis Operations</FONT></H2>
<blockquote>
<A NAME=3>Most A+ structural primitive functions, and functions derived from the operators called Reduce and Scan, apply to the leading axis of the right argument (cf. "<A HREF="APlusRefV2_4.html#0">The Structure of Data</A>"). These structural A+ primitives are Catenate, Take, Drop, Reverse, Rotate, Replicate, and Expand. <A NAME=4>The subarrays obtained by<P>
<UL>
<LI>specifying only the leading axis index, and
<LI>specifying it to be a single, scalar value
</UL>
are called the <i>items</i> of the array. Another way to say that a structural function applies to the leading axis is to say that it rearranges the items, but not the elements within the items.
</blockquote>
<A NAME=HEADING20>
<H2><FONT color="#20B2AA"> Rank <A NAME=5>Operator</FONT></H2>
<blockquote>
The concepts of leading axis and item are generalized by treating an array as a <i>frame</i> defined by the array's leading m axes holding <i>cells</i> of rank n defined by the array's trailing n axes, where m+n is the rank of the array. A function <font face=Kapl>f</font> is applied to all cells of rank n with the expression <font face=Kapl>f@n</font>. The rank operator (<font face=Kapl>@</font>) applies uniformly to all functions of one or two arguments: primitive, derived, or defined, except Assignment and (because of its syntax) Bracket
Indexing (<font face=Kapl>@</font> does apply to Choose, which is semantically equivalent).
</blockquote>
<A NAME=HEADING21>
<H2><FONT color="#20B2AA"> Mapped Files</FONT></H2>
<blockquote>
<A NAME=6>Mapped files are files accessed as simple arrays. These files can be very large (currently of the order of a gigabyte). Only the parts of a file that are actually referenced are brought into real memory, and therefore operations that deal only with parts of files are particularly efficient. Unless the files are extremely large, the transition from application prototypes dealing with ordinary arrays to production applications using mapped files requires only minimal code modification.
</blockquote>
<A NAME=HEADING22>
<H2><FONT color="#20B2AA"> Screens and Workspaces</FONT></H2>
<blockquote>
<A NAME=7>Screens show views of arrays. A workspace is where computation takes place and where all immediately available A+ objects reside - variables, functions, operators, and so on. An array can be displayed on a screen with the <i>show</i> function. The array in the workspace and the screen view share the same storage. Changes to the array in the workspace are immediately reflected on the screen. Changes can be made to the screen view of the array, and they immediately change the array in the workspace. (The word workspace is also used in a different sense in screen management, to denote the leading top-level window.)
</blockquote>
<A NAME=HEADING23>
<H2><FONT color="#20B2AA"> Callbacks</FONT></H2>
<blockquote>
<A NAME=8>Callbacks are automatic invocations of functions that have been associated with variables and events. Specification of a variable or selection of a row in its screen display, for example, can trigger the execution of a callback function. Callbacks provide a complete means of responding to asynchronous events.
</blockquote>
<A NAME=HEADING24>
<H2><FONT color="#20B2AA"> Dependencies</FONT></H2>
<blockquote>
<A NAME=9>Dependencies are global variables with associated definitions. When a dependent variable is referenced its definition will be evaluated if, generally speaking, any objects referenced in the definition have changed since its last evaluation. Otherwise, its stored value is returned. Thus dependencies, like functions, always use the current values of the objects they reference, but are more efficient than functions because they do not reevaluate their definitions until at least one referenced object has changed.
</blockquote>
<A NAME=HEADING25>
<H2><FONT color="#20B2AA"> Con<A NAME=10>texts </FONT></H2>
<blockquote>
Utilities and toolkits can be included in applications without name conflicts, by using
contexts, which allow utility packages and toolkits to have their own private sets of names.
Outside a context, names within are referred to by qualifying them with the context name.
System commands and system functions provide facilities for working with contexts, such as
changing the current context and listing all contexts in the workspace.
</blockquote>
<A NAME=HEADING26>
<H1><FONT color="#20B2AA">Some Features of the A+ System</FONT></H1>
<A NAME=HEADING27>
<H2><FONT color="#20B2AA"> Linux, Solaris, and AIX <A NAME=11>Environments</FONT></H2>
<blockquote>
<A NAME=13>A+ operates under various forms of Unix (Linux, Solaris, AIX, ...).
A+ processes can be started
from a shell or an Emacs or XEmacs session. Hereafter, "Emacs" is used here in a general
sense, to mean Emacs or Xemacs. Emacs provides the application development environment
for A+. It is possible to work in desk calculator mode in an A+ process started under
Emacs. In this mode the user's view of the A+ process is an interactive session, where
expressions can be entered for evaluation, and results are displayed. A session log is
maintained, and can be referenced during the A+ session and saved at the end for future
reference. Desk calculator mode is also the default for an A+ session started in a shell,
but it is more common to use these A+ sessions for running applications with desk
calculator mode turned off. In case an application fails, the appropriate entries to a
log file can be written, or the A+ process can be permitted to return to desk calculator
mode for debugging. An A+ process can communicate with other processes, A+ or not A+,
through a communications interface called <i>adap</i>
(see "<A HREF="APlusRefV2_54.html#0">Interprocess Communication: adap</A>").
</blockquote>
<A NAME=HEADING28>
<H2><FONT color="#20B2AA"> Emacs <A NAME=14>Programming Development Environment</FONT></H2>
<blockquote>
The A+ mode in Emacs provides programmers with very effective ways of testing and debugging applications. Programmers usually work with two visible buffers, one containing an A+ process and the other the source script of an application. Function keys provide the means to move either a single line from the script to the A+ process, where it is automatically executed, or an entire function definition. It is also possible to scroll back in the session log to bring expressions and function definitions forward for editing and reevaluation.
</blockquote>
<A NAME=HEADING29>
<H1><FONT color="#20B2AA">Applica<A NAME=15>tions</FONT></H1>
<blockquote>
Programmers are concerned with three things when writing A+ applications: data, analytics (i.e., computations), and the user interface. The data of interest either reside in files accessible to the application or are maintained by another process. The analytics are the computations run on the data, and the user interface is the means for presenting the data or various aspects of the analytics to users. A+ has been designed for efficient programming of all three aspects of application production, and for efficient execution as well.<P>
<A NAME=16>Data in files are usually maintained in A+ as so-called <i>mapped files</i>
(see "<A HREF="APlusRefV2_19.html#0">Files in A+</A>"), which are simple (i.e., not
enclosed, or nested) arrays. Once an A+ application has opened a mapped file, it deals
with it much as it would an ordinary array of its own creation. Mapped files can be
shared, although shared updates across the network are problematical, unless mediated by
a single process. Unix text files can also be copied into and written out of
A+ processes.<P>
Real-time data, which is of the utmost importance to many A+ applications, is accessed through an interprocess communication toolkit called <i>adap</i>. This toolkit provides a small number of functions for establishing and maintaining communication between an A+ process and other processes, such as a set of real-time data managers that read and write A+ arrays.<P>
As an array-oriented language with a set of primitive functions that apply directly to entire arrays, A+ provides very efficient processing of functions that apply to large collections of data, often with less code than more conventional programming languages. Less code generally means fewer chances for failure; moreover, the A+ language processor is interpretive, which makes debugging relatively easy. Unless you take advantage of array calculations, however, being in an interpretive environment is likely to hurt you in performance. Thinking in terms of array algorithms is both a requirement and an opportunity, and it differentiates development in APL-derived environments from development in most other environments.<P>
Application user interfaces are built with the A+ screen management system, a toolkit that relies on a small number of functions to create and interact with a variety of screen objects, such as buttons, tables, and layouts. See the chapters on screen management, display classes, and display attributes.
</blockquote>
<A NAME=HEADING30>
<H2><FONT color="#20B2AA"> Script Files</FONT></H2>
<blockquote>
<A NAME=17>Applications are maintained in text files called scripts. Scripts contain function and data definitions and executable expressions. A+ has specific facilities for loading scripts. Loading a script has much the same effect as entering the lines of the script one at a time in desk calculator mode, starting at the top. Scripts can contain the A+ expressions for loading other scripts. Consequently application scripts do not have to contain copies of utilities and toolkits, and A+ applications tend to be very modular.
</blockquote>
<A NAME=HEADING31>
<H1><FONT color="#20B2AA">The A+ <A NAME=18>Keyboard</FONT></H1>
<blockquote><A NAME=21>
A+ uses the APL Union Keyboard.
The special APL characters are entered by
pressing a key while pressing either the <b>Meta</b> key,
or both the <b>Meta</b> and <b>Shift</b> keys.
The <b>Meta</b> keys (on Sun keyboards) are on either side of the
<b>space</b> bar and are marked with diamonds.
IBM keyboards have no <b>Meta</b> keys;
use the <b>Alt</b> key, similarly situated,
instead of <b>Meta</b>.
<p>
Note: <b>Meta-Shift-m</b> looks like
<b>Meta-m</b> and <b>Shift-\</b>
but does not represent an A+ function.
<p>
An <A HREF="keyboard.html" TARGET=_parent onMouseOver="window.status='B&W image of A+ keyboard layout';return true".>Interactive Keyboard Chart</a> is also available,
providing additional information about each of the A+ symbols and functions.
<p>
<center>
<img src="keyboard.gif">
</center>
<br><spacer type=vertical size=10>
<img src="KeyXp1.gif">
<br><spacer type=vertical size=15>
<center>
<A HREF="keybdBW.html" TARGET=_parent onMouseOver="window.status='B&W image of A+ keyboard layout';return true".>Click here</a> for a keyboard diagram which will print more clearly on a black-and-white laser printer.
<p>
This figure is available as a printed <i>Keyboard Reference Chart Tentcard</i>,
which is designed to stand up on your desktop beside your workstation.
To request a copy, contact doc@aplusdev.org.
</center>
<HR>
<ADDRESS><table width="100%"><tr><td><font size=2><i><a href="mailto:doc@aplusdev.org">doc@aplusdev.org</a></i></font></td><td align=right><font size=2><i>© Copyright 1995–2008 Morgan Stanley Dean Witter & Co. All rights reserved.</i></font></td></tr></table></ADDRESS>
</BODY>
</HTML>
|