Bringing APL down to earth on the DECsystem-10: Standard characters and a standard editor

Fred A. Masterson
<span title="">1981</span> <i title="Springer Nature"> <a target="_blank" rel="noopener" href="" style="color: black;">Behavior Research Methods</a> </i> &nbsp;
The APL programming language provides an unprecedented combination of simplicity and power. Simplicity characterizes program preparation. Since APL code is interpreted, programs ("functions," as they are called in APL) can be executed as soon as they are written, without the frustrating delays commonly interpolated by compilers. Furthermore, any APL program (function) can pass control to another APL program (function) without a preliminary time-consuming linking procedure. Finally, individual
more &raquo; ... nes of APL code can be interpreted outside an official function definition, a feature that encourages trial-and-error learning. In all these respects, APL shares or improves upon the breezy informality of interactive BASIC, but, unlike BASIC, APL does not disappoint advanced students of programming. APL is a superior programming system for statistical data analysis. The interactive flexibility of APL facilitates exploratory data analysis. In addition, APL provides powerful operators for the manipulation and transformation of tabular (matrix) data structures. Formulas for univariate or multivariate analysis can be transcribed into APL on a line-to-line basis (i.e., one line of mathematical formula converts to one line of APL code), instead of the one-line-to-many-line basis required by ALGOL, FORTRAN, or PASCAL-type languages. This one-to-one correspondence between mathematics and APL is hardly surprising, since APL was originally created not as a computer programming language, but as an improved notation for algebraic formula (Iverson, 1962) . It is regrettable that a language with so many positive features has not gained wider acceptance among researchers in the behavioral sciences. Potential users are discouraged by three major drawbacks. The first drawback is that APL requires terminals with a special keyboard. Such terminals are relatively scarce at many computing installations, so users have to wait in line. Furthermore, once a user gains access to an APL terminal, he or she is likely to be annoyed by the novel positions of such standard characters as left and right parentheses. Learning the positions of special APL characters is bad enough: There is no reasonable justification for requiring users to learn new key locations for standard characters. The second drawback to current APL implementations is the required use of a special APL editor. Most computer systems feature a multipurpose editor that serves to edit data files, word processing files, and program source code files. Why, then, should APL require users to master a different editor? This question is particularly important in light of the obvious inferiority of many APL editors to the general-purpose editor of the typical host computer system. The third drawback to APL is its popular reputation as a "write-only language." This reputation has resulted more from the style of seasoned APL programmers than from APL itself. Expressions in APL are fantastically economical, and it is a huge temptation to push this economy to the extreme by writing highly compressed code. While this may be a defensible practice for experienced APL programmers, it should be resisted by beginning and occasional users of APL, for whom lengthier, easier to read code is desirable. The extreme compactness of pure APL is illustrated in Figures la and lb. Both examples compute the chisquare statistic for testing the reliability of a relationship between two categorical variables. In Figure la , (b) ) CHISO~+/+/[1]«O-EI~21+E~«+/OI •• X+/C1]OI+(r 0lr+/+/[1]0 HMAT~(r OBSMATlr+/+/C1]OBSMAT EX~MAT~«+/OBSMATl·.x(+/[1]OBSMATll+NMAT CHISO~+/+/[1]«OBSMAT-EX~MATI~21+EX~MAT (e) NMAT_(SIZE OBSMATISHAPE SUM COLSUM OBSMAT OF'ERATORL I t I EXPMAT_«SUM OBSMATIOUTPROD(COLSUM OBSMATIIXNMAT CHISQ_SUM COLSUM«OBSMAT-EXPMATI*2IXEXPMAT Figure 1. (a) A one-line APL program for the chi-square computation. 0 is the matrix of observed frequencies, E is the matrix of expected frequencies, and CHISQ is the value of the chi-square statistic. (b) The chi-square computation spread out over three lines of APL code. The names for the matrices of observed and expected frequencies have been extended for greater readability. NMAT is a matrix in which every element is equal to the total number of observations. NMAT has the same dimensions as OBSMAT and EXPMAT. (c) The code for the chi-square computation in the present system. The difference between this and the listing in Figure 1b lies in the use of standard characters and the use of more suggestive names for operators. (The second line stores the operator-in this case, multiplication-that is to be used in the outer product in Line 3.)
<span class="external-identifiers"> <a target="_blank" rel="external noopener noreferrer" href="">doi:10.3758/bf03202036</a> <a target="_blank" rel="external noopener" href="">fatcat:dsgy2rnsyrhixii5xzepgpyfcq</a> </span>
<a target="_blank" rel="noopener" href="" title="fulltext PDF download" data-goatcounter-click="serp-fulltext" data-goatcounter-title="serp-fulltext"> <button class="ui simple right pointing dropdown compact black labeled icon button serp-button"> <i class="icon ia-icon"></i> Web Archive [PDF] <div class="menu fulltext-thumbnail"> <img src="" alt="fulltext thumbnail" loading="lazy"> </div> </button> </a> <a target="_blank" rel="external noopener noreferrer" href=""> <button class="ui left aligned compact blue labeled icon button serp-button"> <i class="external alternate icon"></i> Publisher / </button> </a>