APL360 Users Manual
APL360 Users Manual
333330000000000\\\\\LLLLLPPPPP66666\\\\\AAAAAAAAAAAAAAA 66666
333330000000000\\\\\LLLLLPPPPP66666\\\\\AAAAAAAAAAAAAAA 66666
3.333_30.000000000\ \\ \ \LLLLLPPPPP66666\ \ \ \ \AAAAAAAAAAAAAAA 66666
PPPPP AAAAA66666\\\\\66666\\\\\00000 6[)666LLLLL
PPPPP AAAAA66666\\\\\66666\\\\\00000 66666LLLLL
ppppp: AAAAA66666\ \\ \\66'666\\ \\ \00000 66666LLLLL
LLLLL66666 00000 AAAAA\\\\\\\\\\ 00000 \\\\\
LLLLLS6£66 00000 AAAAA\\\\\\\\\\ 00000 \\\\\
LLLLL66666 00000 AAAAA\\\\\\\\\\ 00000 \\\\\
AAAAA0000066666 66666 33333 6666600000 AAAAA
AAAAA0000066666 66666 33333 6666600000 AAAAA
AAAAA0000066666 66666 33333 6666600000 AAAAA
PPPPP66666LLLLLOOOOO\\\\\ PPPPP\\\\\ AAAAAOOOOO
PPPPP66666LLLLLOOOOO\\\\\ PPPPP\\\\\ AAAAAOOOOO
PPPPP66666LLLLLOOOOO\\\\\ PPPPP\\\\\ AAAAAOOOOO
LLLLL33333PPPPPAAAAA\\\\\ PPPPP 6666600000\\\\\
LLLLL33333PPPPPAAAAA\\\\\ PPPPP 6666600000\\\\\
LLLLL33333PPPPPAAAAA\\\\\ PPPPP 6666600000\\\\\
33333 LLLLLLLLLL\\\\\AAAAALLLLL AAAAA\\\\\\\\\\
33333 LLLLLLLLLL\\\\\AAAAALLLLL AAAAA\\\\\\\\\\
33333 LLLLLLLLLL\\\\\AAAAALLLLL AAAAA\\\\\\\\\\
AAAAA\\\\\3333366666AAAAALLLLL33333PPPPP 66666 00000
AAAAA\\\\\3333366666AAAAALLLLL33333PPPPP 66666 00000
AAAAA\\\\\3333366666AAAAALLLLL33333PPPPP 66666 00000
66666\\\\\66666\\\\\\\\\\PPPPPLLLLLPPPPP\\\\\00000 AAAAA
66666\\\\\66666\\\\\\\\\\PPPPPLLLLLPPPPP\\\\\00000 AAAAA
66666\\\\\66666\\\\\\\\\\PPPPPLLLLLPPPPP\\\\\00000 AAAAA
AAAAALLLLLPPPPP33333LLLLL\\\\\66666LLLLLAAAAAPPPPP\\\\\AAAAA
AAAAALLLLLPPPPP33333LLLLL\\\\\66666LLLLLAAAAAPPPPP\\\\\AAAAA
AAAAALLLLLPPPPP33333LLLLL\\\\\66666LLLLLAAAAAPPPPP\\\\\AAAAA
666666.66666666600000333330000033333LLLLL66666\ \ \ \ \PPPPP33333
66666666666666600000333330000033333LLLLL66666\\\\\PPPPP33333
66666666666666600000333330000033333LLLLL66666\\\\\PPPPP33333
\\\\ 33333LLLLLQ00003333300000AAAAA
\\\.\ ":3 ;3·3 3 :3 LL LLL 0 60 0 0 3 3·3 3 3 0 0 0 a 0 AA AAA
a 00\\\\\ 33333LL~LL000003333300000AAAAA
AAAAAAAAAAOOOOOLLLLL \\\\\LLLLL PPPPP66666
AAAAAAAAAAOOOOOLLLLL \\\\\tLLLL PPPPP66666
AAAAAAAAAAOOOOOLLLLL \\\\\LLLLL PPPPP66666
A. D. Falkoff
K. E. Iverson
FUNDAMENTALS 3.1
Statements, Scalar and vector constants, Names
and spaces, Overstriking and erasure, End of
statement, Order of execution, Error reports,
Names of primitive functions
SCALAR FUNCTIONS 3.5
Monadic and dyadic functions, vectors, Index
generator
DEFINED FUNCTIONS 3.10
Introduction, Branching, Local and global
variables, Explicit argument, Explicit result,
The forms of defined functions, Use of defined
functions, Recursive function definition, Trace
control
MECHANICS OF FUNCTION DEFINITION 3.17
Labels, Revision, Display, Line editing,
Reopening function definition, Locked functions,
Deletion of functions and variables, System
command entered during function definition
SUSPENDED FUNCTION EXECUTION 3.20
Suspension, State indicator, stop control
HOMONYMS 3.22
Variable names, Function names
INPUT AND OUTPUT 3.23
Evaluated input, Character input, Escape from
input loop, Normal output, Heterogeneous output
RECTANGULAR ARRAYS 3.26
Introduction, Vectors dimension catenation,
Matrices dimension ravel, Reshape, Uses of empty
arrays, Indexing, Indexing on the left, Index
origin, Array output
FUNCTIONS ON ARRAYS 3.33
Scalar functions, Reduction, Inner product,
Outer product
MIXED FUNCTIONS 3.37
Introduction, Transpose, Monadic transpose,
Rotate, Reverse, Compress, Expand, Decode,
Encode, Index of, Membership, Take and drop,
Grade up and down, Deal, Comments
MULTIPLE SPECIFICATION 3.45
SYSTEM DEPENDENT FUNCTIONS 3.46
APPENDIX A
SAMPLE TERMINAL SESSION
APPENDIX B
ADVANCED EXAMPLES
BIBLIOGRAPHY
LIST OF ILLUSTRATIONS
1.1
FEATURE OR OPTION 1050 2740-1 2741
1.2
[iliD;....-""-~~~---"';;' ~--"-~-"--~I\..,-~~ ~
? w
Q W
[~ J_~~~ __~_~_~_~_~_~_~_~~~~~
F J K
[SHIFT~ B
Figure 1.2: APL\360 KEYBOARD
JJ':2.e Qf Qth.ex-
.cbg..ra.Qte.r §ets. The part numbers of APL
printing elements are given in Table 1.1. However, any
pz'Lrrt.Lnq element may be used wi th the APL system, since the
encoded characters generated by the keyboard and transmitted
to the comput.er are independent of the particular element
mounted on the ,terminal. Subject to programmed
intervention, the transmitted information will always be
interpreted according to the APL keyboard characters.
1.3
THE RECORDING TERMINAL
As connections with remote terminals are established
and broken, and users start and end work sessions, a printed
record of this traffic is generated at the system's
~§gQ~g~ng t§~IDingl. This terminal, which is usually, but
not necessarily, located at the central computer site, is
ordinarily attended by an AEL Q~eratQr who monitors the
operation of the system, and provides a common point of
contact for users.
There are certain supervisory functions, essential to
the operation of APL\360, which can be effected only from
the recording terminal. Thus, this terminal holds a
privileged position relative to others. The enrollment of
new users, and the allocation of library space, are examples
of this kind of function.
ESTABLISHING A CONNECTION
The directions that follow assume the use of a dial-up
connection with a dataset. Instructions for the use of
acoustic couplers should be obtained from their suppliers.
Where terminals are connected to the computer by leased
lines or private wires, instructions on dialing procedure
(EC2) are irrelevant, but local sources of information
should be consulted for equivalent procedures.
1.4
IBM 1050 Terminal
ATTEND/UNATTEND A'rTEND Not all 1050's have all
Keyboard SEND switches; those present must
Printer SEND-RECEIVE be set as indicated. The
Reader 1 OFF states of switches not
Punch 1 OFF listed here are immaterial.
EOB MANUAL
Line .test OFF If it is known that RPQ
Single step OFF E27283 (see Table 1.1) is
Line control ON installed, set the EOB
Power ON switch to AUTO.
The line control switch is
inside the rear door of the
1051 Control Unit. The
power switch is on the left
side of the control unit,
toward the front.
1.5
Promptly set the pushbutton The DAT~ button should
switch to DATA by holding light, and will remain· lit
the DATA button down firmly as long as the terminal is
for a moment and then connected to the computer.
releasing. If it does not light, check
the power connection to the
Cradle the handset. dataset. If it lights, but
quickly goes out, check the
power connection to the
terminal, the cable
connection to the dataset,
and the switch settings on
the terminal. Then retry
from Eel.
1.6
10.5.0 I. On terminals equipped wi th an automatic EOB RPQ
(see Table 1.1), the transmission signal is produced
automatically when t.he RETURN key is struck. Otherwise,
an EOB must be produced manually, by striking the
nume r a.l-eS key, while the key marked ALTN CODING is
belg dQ~D. (Note that the automatic EOB feaxuIe available
for 1050 terminals cannot be used with APL\360.)
A, transmission signal does not cause a character to be
printed, and its omission will therefore be evidenced only
by the state of the terminal: the keyboard will remain
unlocked, and no response will be forthcoming from the
system.
In the remainder of this manual the need for carrier
return and 'transmission signal will not be explici tly
mention.ed, since they are required for .eY.er~ entry.
Mis.takfH3.. Before the carrier return (and transmission
signal) that completes an entry, errors in typing can be
co r.re c te d as follows: backspace to the point of error and
then depress the linefeed button (marked ATTN on 2741
terminals). ~rhis will have the effect of eras ing everything
to the right of, and including, the position of the carrier.
The corrected text can be continued from that point, on the
new line.
This procedure can be used at any time once the sign-on
(EC3) has been accomplished. In case of error in the
sign-on itself, the entry should be made as is. The system
will provide an appropriate .t~Quble repQrt, following which,
a correct entry may be made.
X;r;:a.o.smisaiQn
.errQrs. There are occasional transient
failures in the communication between a terminal and the
cerrt r a L computer. If the failure occu.rs during the
transmission from the terminal, the system will respond with
a I'§§§;n.g signal: on 1050 terminals, the RESEND warning
light will go on, and on other terminals the message RES END
will be print:ed. In any case, the last entry from the
keyboard must be repeated. The warning light on the 1050
should first be extinguished by pressing the adjacent
button.
Failures in the other direction are usually evidenced
by the appearance of a spurious character, whose presence in
the printed output is obvious in most contexts. However,
there is no absolutely certain way of detecting such a
failure.
1.7
S~ecigl features 01 IEM lQ5D terminals. The keyboard of a
terminal equipped with a REQUBST button will not unlock,
when it otherwise should, until the button is depressed. On
terminals equipped with a timer, the keyboard will lock
before an entry is completed if approximately 18 seconds
have elapsed since the last keyboard action. Locking can be
forestalled by occasionally striking the shift key, but if
it does happen, the keyboard can be forced to unlock by
flipping the line-control switch inside the 1051 Control
Unit to OFF, and back to ON.
If a terminal is to be used exclusively with APL\360,
the Keyboard Request feature should be removed, and the Text
Time-out Suppression feature should be added.
1.8
1~.t.f§.9~ :
1. A workspace will be A workspace can be thought
activated for the terminal. of as both a notebook and a
scratch pad. The details
2. Accumulation of time are explained in Part 2.
charges will begin.
1.9
3. SAVED, follow\~d by the This response will be
time of day and date that omitted if the activated
the activated workspace was workspace is ~1~9L (i.e.,
last stored. not holding information).
If the respc:nse is given,
the workspace is named
CONTINUE. The use of
workspace names is explained
in Part 2.
4. The keyboard will be If this is the only reponse,
unlocked. a transmission error has
occurred, or the entry did
not start with an APL right
parenthesis. In either
case, the ent.ry should be
repeated in correct form.
If the condition persists,
retry from EC2, possibly
dialing a different number.
1.10
:2. The duration of the work
ae aai.on and the amount of
compucez time used wil'l. be
noted internally for later
accounting.
!~ff§gt:
JL. 2. arid 3. The same as for
EC4.
1.11
PART 2
SYSTEM, COMMANDS
2.1
~1Q~g~!g§. Inactive workspaces are stored in lig~g~i~§,
where they are identified by arbitrary names. They occupy
space in secondary storage facilities of the central
computer and cannot be worked with directly. When required,
copies of stored workspaces can be made active, or selected
information may be copied from them into an active
workspace.
NAMES
2.2
~Qg~l ~n~ glQb~l ~ignifig~ng§. In the execution of defined
functions it is often necessary to work with intermediate
results which have no significance either before or after
t:he function is used. To avoid cluttering the workspace
with a multitude of variables introduced for such transient
purposes, and to allow greater freedom in the choice of
names, the function definition process (see Part 3) provides
a facility for designating certain variables as lQg~l to the
function being defined. Variables not so designated, and
all functions and groups, are said to be glQf?§:l.
A local variable may have the same name as a global
object" and any number of variables local t.o different
f unc t Lon s may have the same name.
2.3
ATTENTION
Printed output at a terminal can be cut off, or the
execution of an APL operation can be interrupted, and
control returned to the user, by means of an gtt~DtiQD
~ign~b. Since the keyboard 1S locked during printing or
computing, the signal must be generated by means other than
one of the standard keys.
On terminals equipped with an interrupt feature, the
attention signal is generated by depressing the appropriate
key once, firmly. On IBM 2741 terminals this key is usually
of a distinctive color, and is marked ATTN. (The same key
is used for linefeed when the keyboard is not locked.)
For terminals not so equipped, the attention signal is
generated by momentarily interrupting the connection to the
central computer. The method depends upon the type of
connection:
with dial-up telephones, uncradle the handset, set
the pushbutton switch to TALK for two to three
seconds, and then reset it to DATA;
with leased telephone lines, set the terminal power
switch to OFF and then back to ON, with deliberate
speed.
If the connection is broken, in either case, for more than
five seconds, the central computer will interpret this as a
signal to end the work session and will execute action EC4
of Part 1.
Following an attention signal the keyboard will unlock,
and the type carrier will return to the normal position for
input (six spaces from the left margin). If the carrier
does not do this, enter blank lines repeatedly until it
does. In some cases a line will be printed before the
keyboard unlocks, telling where a function in progress was
interrupted.
Except for communication commands (and then only if the
delivery of a message is delayed), the execution of system
commands, once entered, cannot be interrupted. However, the
printed responses or trouble reports following a system
command can be suppressed by a properly timed attention
signal.
2.4
USE OF SYSTEM COMMANDS
System
commands and APL operations are distinguished
;~.YD.9.ti-,QDg.1J:..Y
by the fact that system commands can be called
for only by individual entries from the keyboard, and cannot
be executed dynamically as part of a defined function. They
are distinguished in iQ~ by the requirement that system
commands be prefixed by a right parenthesis, which is a
syntactically invalid construction in APL.
There is some system control which it may be desirable
to exert dynamically, and there are some items of system
information which can be profitably used during the
execution of a program. For these purposes APL\360 provides
appropriate .§.Y.§.tgID=.9g12~DggD.t .fYDgtiQD~ and .1ibX.9J:Y
JYD.9.tigD.§, wh i ch can be used like other APL operations.
These functions are described in Part 3 and Part 4,
z'e s peot.LveLy , Where a system command duplicates the action
of one of them, this fact will be noted in the description
of the system command in this Part.
All syst:em commands can be executed when the terminal
i.s in the g~§.9Y.t1QD IDQ.9§, in which APL operations are
exe cut.e d forthwith upon entry. However, in .9g.fiIli.t.iQD IDQ.9g,
in which sequences of operations are being composed into
functions for later execution, commands which call for
storin9 a copy of the workspace, or which might otherwise
interfere with the definition process itself, are forbidden.
(The t\Y'O terminal modes are treated more fully in Part 3.)
~lg'§'§.!~~.!.9.9.t.!QD
Q.t .9QIDIDBD9'§ • Sy stem commands are
conveniently grouped into five classes with regard to their
effect upon the state of the system:
1 .. ~g~ID.!n.9.! .9Qn.t~Q.! commands affect the relation of a
t.e rmi na L to the system.
2.5
The text that follows is based upon this
classification, although it will be seen that certain of the
terminal control commands also affect the libraries, and one
of the library control commands may sometimes affect the
state of the active workspace.
2.6
Reference and Purpose
COMMAND FORM 1,2,3 NORMAL RESPONSE TROUBLE REPORTS"
1-----------------------------------------.-------------------4
TCl Sign on designated user and start a work session.
)NUMBER [KEY] [TEXT]; PORT, TIME,.DATE,USER; SYSTEM; [SAVED ,TIME,DATE] 1 2 3 4 5
TC2 End work session.
)OFF [LOCK] PORT,TIME,DATE, USER CODE; TIME USED 16
TC3 End work session and hold dial-up connection.
)OFF HOLD (IJOCK] PORT,TIME,DATE,USER CODE; TIME USED 16
TC4 End work session and store active workspace.
)CONTINUE [LOCK] [TIME,DATE,CONTINUE]; PORT,TIME,DATE, USER CODE; TIME USED 6 16
TC5 End work session, store active workspace, and hold dial-up connection.
)CONTINUE HOLD [LOCK] [TIME,DATE,CONTINUE]; PORT, TIME, DATE,USER CODE; TIME USED 6 16
WC1 Activate a clear workspace.
) CLEAR CLEAR WS 16
WC2 Activate a copy of a stored workspace.
)LOAD WSID [KEY] SAVED,TIME,DATE 7 8 16
WC3 Copy a global object from a stored workspace.
) COPY WSID [KEY] NAME SAVED, TIME, DATE 6 7 8 9 10 16
WC3a Copy all global objects from a stored workspace.
) COPY WSID [KEY] SA VED , TIME, DATE 6 7 8 10 16
WC4 Copy a global object from a stored workspace, protecting active workspace.
)PCOPY WSID [KEY] NAME SAVED,TIME,DATE; [NOT COPIED: ,LIST OF OBJECTS] 6 7 8 9 10 16
WC4a Copy all global objects from a stored workspace, protecting acti.ve workspace.
)PCOPY WSID [KEY] SAVED,TIME,DATE; [NOT COPIED: ,LIST OF OBJECTS] 6 7 8 10 16
WC5 Gather objects into a group.
)GROUP NAME[S] NONE 11 16
WC6 Erase global objects.
)ERASE NAME[S] [NOT ERASED: ,LIST OF OBJECTS] 16
WC7 Set index origin :Eor array operations.
)ORIGIN INTE:GER,O-l WAS ,FORMER ORIGIN 16
WCO Set maximum for significant digits in output.
)DIGITS INTEGER,1-16 WAS ,.FORMER MAXIMUM __ 16
WC9 Set maximum width for an output line. TROUBLE REPORT FORMS
)WIDTH INTEGER, 30-130 WAS ,FORMER WIDTH 1 NUMBER NOT IN SYSTEM 16
WClO Change workspace identification. 2 INCORRECT SIGN-ON
) WSID WSID WAS, FORMER WSID 3 ALREADY SIGNED ON 16
LC1 Re-store a copy o:E the active workspace. 4 NUMBER IN USE
)SAVE TIME,DATE,WSID 5 NUMBER LOCKED OUT 6 12 13 14 16
LC1a Store a copy of the active workspace. 6 NOT WITH OPEN DEFINITION
)SAVE WSID [LOCK] TIME, DATE 7 WS NOT FOUND 6 12 13 14 16
LC2 Erase a stored workspace. 8 WS LOCKED
)DROP WSID TIME, DATE 9 OBJECT NOT FOUND 7 14 16
101 List names of defined functions. 10 WS FULL
)FNS [LETTER] FUNCTION NAMES 11 NOT GROUPED. NAME IN USE 16
102 List names of global variables. 12 NOT SAVED. WS QUOTA USED UP
)VARB [LETTER] VARIABLE NAMES 13 NOT BAVED. THIB WS IS WSID 16
103 List names of groups. 14 IMPROPER LIBRARY REFERENCE
)GRPB [LETTER] GROUP NAMES 15 MESSAGE LOST 16
104 List membership o:E designa·ted group. 16 INCORRECT COMMAND
)GRP NAME FUNCTION NAMES, VARIABLE NAMES 16
105 List halted functions (state indicator).
)SI SEQUENCE OF HALTED FUNCTIONS 16
106 List ha.l t.ed functions and associated local variables (augmented state indicator).
)SIV SEOUENCE OF HALTED FUNCTIONS WITH NAMES OF LOCAL VARIABLES 16
107 Give identification of active workspace.
)WSID WSID 16
100 List names of workspaces in designated library.
)LIB [NUMBER] NAMES OF STORED WORKSPACES 14 16
109 List ports in use and codes of connected users.
)PORTS PORT NUMBERS AND ASSOCIATED USER CODES 16
IQ10 List port: numbers associated with designated user code.
)PORTS CODE PORT NUMBERS 16
CM1 Address t:ext to designated port.
)MSGN PORT [TEXT] SENT 15 16
CM2 Address text to de s Lqna t ed port, and lock keyboard.
)MSG PORT ['l'EXT] SE NT 15 16
CM3 Address t.ext; to recording terminal (APL Operator).
)OPRN [TEXT]' SENT 15 16
CM4 Address t:ext to zeoo rdd nq terminal (APIJ Operator), and lock keyboard.
)OPR [TEXT] SENT 15 16
Notes: 1. Items in brackets are optional.
2. KEY or LOCK: a password set off from preceding text by a colon.
3. WSID: library number and workspace name, or workspace name alone, as required.
4. See insert table of trouble report forms.
~--------------------------------------------------------'
2.7
TERMINAL CONTROL COMMANDS
2.8
I.nt~J;:;r;:YJ2t§.g gQtiyitiJ~~§'. An "APL operation in progress at the
moment of occurrence of a bounce or disconnect mayor may
not be carried to its normal conclusion. A defined function
in progress at such a moment will be suspended, but its
p ro qz'e s s can be resumed at a later work session in
accordance with the procedures given in Part 30 A system
command, once begun, will continue to completion regardless
of the state of the terminal.
2.9
~~~~ ~ng ~Q~~ ~~e~!Qn: Passwords longer than eight
Enter )OFF characters are accepted, but
followed by a colon and a only the first eight are
password, if desired. meaningful. Spaces around
the colon are neutral.
~t:!~~t:
1. The currently
workspace will vanish.
active There is no effect on
stored workspace.
any I
2. The duration of the work
session and the amount of
computer time used will be
noted internally for later
accounting.
3. The password, if used, Once applied, a lock stays
will become a new lock on in effect until explicitly
the account number. changed by an ending command
that contains a colon.
An existing lock is removed
if no password follows the
colon.
If a colon is not used, the
existing lock, if any,
remains in force.
4. A dial-up connection to
the central computer will be
broken.
2.10
11~~..!. ~~n.Q. :y{Q,~~ §g§§ .!Q~ ~~g See note at TC2.
!J.Q.!g gi:£,:J:=Y1? 9Q!1!}g,g!-.!Q!}:
Enter )OFP HOLD
followed by a colon and a
password, if desired.
~g!~f:!::
1. 2. and 3. Same as for
TC2.
4. The! dial-up telephone An attention signal at this
connection will be time may cause the
maintained for 60 seconds, connection to be broken.
pending a new sign-on.
~;h~~£:!= :
1. A copy of the currently This effect will not take
active workspace will be place if the active
stored in the user's private workspace is not holding
library with the name information.
CONTINUE. If the workspace
had been activated from a When the workspace is saved
s t.o re d workspace with a it replaces any workspace
lock, the same lock will be previously stored with the
applied to CONTINUE. name CONTINUE.
26 3. and 4. Same as for
TC2.
2.11
B~!H?Qn§g :
1. Time of day and date, This response will be
followed by CONTINUE. omitted if the workspace was
not saved. See note at
Effect 1.
2. and 3. Same as
response 1 and 2.
for TC2, 1'~QY!?1§ ~§2Q~~§:
NOT WITH OPEN DEFINITION
I
means that the terminal is
in definition mode. Close
the definition by entering
the character V. (See
mechanics of function
definition in Part 3.)
INCORRECT COMMAND
I~2~ ~ng ~Q~~ §§§§!QDL See note at TC2.
§tQ~g ~gt!y§ ~Q~~§Qig@L~n~
QQ!g g~~!=gE £Qnng£~!Qn:
Enter )CONTINUE HOLD
followed by a colon and a
password, if desired.
~ff§~t:
1. Same as for TC4.
2.12
WORKSPACE CONTROL COMMANDS
2.13
sets of parallel commands which differ only in their
treatment of an object in the active workspace which has the
same name as an object being reproduced: the copy commands
will replace the existing object, whereas the
protecting-copy commands will not make the replacement.
A copy command of either type can be applied to an
entire workspace or to a single object (i.e., a function,
variable, or group). When an entire workspace is copied,
I
all the functions and global variables within it are subject
to the operation, but its index origin and output control
settings, state indicator, and local variables are left
behind.
When a group is copied without protection, both its
definition (i.e., the group name and the collection of names
composing the group), and the objects referenced by the
names within it, are reproduced in the active workspace.
When copied with protection, the group itself, or any of the
objects referenced by its members, will be omitted in order
to protect an object in the active workspace. If the group
definition is successfully copied under these circumstances,
the names composing it will refer to the global objects by
those names in the active workspace, regardless of whether
they were copied' with the group or present before.
-P~.:t:£lj..l~g .P~'§..91;j..PJ:j..9D •
The te rm jj.9..*Js:.§.P£l..9§ j.g~llJ:i-.fi-..9£lJ:j..911 is
used here to mean either a library number followed by a
workspace name, or a workspace name alone. When a name is
used alone, the reference is to the user's private library.
A ~§Y is a colon followed by a password.
Eii~.9.:t::
1. A clear workspace will be A clear workspace has no
activated, replacing the variables, groups, or
presently active workspace. defined functions.
Its control settings are:
index origin, 1; significant
digits, 10; line width, 120.
Its workspace identification
does not match that of any
stored workspace. (See
section on library control.)
2.14
B.!~§.P.Q n§..§ : ~J:Qubl.e x:.eI2QJ::t
1,. CLEAR WS INCORRECT COMMAND
~~ht~£.!: :
1,. A copy of the designated
workspace will be activated,
replacing the presently
a ct.L ve workspace.
.E§§.PQ!!§g: ~!:Qg!2.!~
I:gJ2Q!:t§
1. SAVED, followed by the WS NOT FOUND
time of day and the date means there is no stored
that the source workspace workspace with the given
wa.s last stored. identification.
WS LOCKED
means that no key, or the
wrong key, was used when one
was required.
INCORRECT COMMAND
2.15
B§§WD:§§: ~I:QYQlg I:sU2QI::te
1. SAVED, followed by the NOT WITH OPEN DEFINITION
time of day and the date means that the terminal is
that the source workspace in definition mode. Either
was last stored. close the definition by
entering v, or defer the
copy operation.
WS NOT FOUND
See WC2.
I
WS LOCKED
See WC2.
OBJECT NOT FOUND
means that the designated
workspace does not contain a
global object with the given
name.
WS FULL
means that the active
workspace could not contain
all the material requested:
if copied at all, a variable
will be copied completely; a
partially copied function
will leave the terminal in
definition mode; some
objects may be completely
overlooked. Status may be
determined by using appro-
priate inquiry commands.
INCORRECT COMMAND
~ti§g.:t.:
1. A copy of all functions, Local variables, the state
groups, and global variables indicator, and settings for
in the source workspace will origin, significant digits,
appear in the active and width are not copied.
workspace with global
significance, replacing
existing global homonymsc
2.16
S~~'§.l?Qn§.~ : ~!:QY12.!g !:~12Q!:j;~
1.. SA VED, followed by the NOT WITH OPEN DEFINITION
time of day and the date WS NOT FOUND
that the source workspace WS LOCKED
was last stored. WS FULL
INCORRECT COMMAND
See We3 for all meanings.
~]~fg9t :
1., A copy of the designated When a group definition is
object will appear in the copied, any member whose
active workspace unless referent was blocked will,
there is an existin.g global p~rforce, refer to the
homonym. referent of its homonym.
2.17
WQ~~~ ~QQY gIl glQ~gl See notes at WC3.
QQj~g~§ from ~ §tQ~gg
~Q~~§QgQg, Q~Qtggt~ng thg
gQt!y§ ~Q~~§Q~9~:
Enter )PCOpy
followed by a space and a
workspace identification
(with the key, if required).
I
~ffggt:
1. A copy of all global See note at WC3a, Effect 1.
objects in the source
workspace which do not have See note at WC4, Effect 1.
global homonyms in the
active workspace will appear
in the active workspace.
2.18
~'~.2.!. ~i9:!:hg!:
9!:QYI2:
Enter )GROUP
followed by a space and one
or more names separated by
spaces.
~~I~,gj;:
1. The first name will be The first name used in the
the name of a group having command must not be the name
the other names as members, of a function or global
subject. to the rules given variable.
in the adjacent notes. An
existing group with the same Any name may be a member of
name wi.ll be superseded. a group; names of groups,
functions, and global
variables, and names without
current global referents are
all acceptable.
Members may be added eto an
existing group by using the
group name twice in the
command: as the first name
and as another.
2. If only one name is used When a group is dispersed
in the command, no group is the group definition is
formed, and an existing destroyed, but the referents
g:coup by 1:hat name is of the group members are
dispersed. unaffected.
~J::QYbl~ ~§I2QJ::.t§:
NOT GROUPED, NAME IN USE
means that the first name
used in the command is the
name of a function or global
variable. Erase the
offending object, or use a
different name.
INCORRECT COMMAND
2.19
~~§~ ~~~~~ g!QQ~! QQj~2~~: This is the only way to
Enter )ERASE remove a global variable,
followed by a space and the and the most convenient way
names of objects to be to remove a collection of
deleted, separated by objects.
spaces.
~f!~£~:
1. Named objects having Names which do not refer to
I
global significance, other global objects are ignored.
than pendent functions, will
be expunged. When a group is erased, both
the group and the referents
of its members are expunged.
~!!~.9!::
1. First elements of arrays These matters are explained
in the workspace will be in Part 3.
numbered zero or one, as
indicated, and subsequent
use of index-dependent APL
operations will be
appropriately affected •
2.20
N~~.e..!. .s§1- IDg~.!IDYID f9£' .§.!g= A dynamically executable
~l!figgnt gig.it.§ .in Qy.tf>Y.t: equivalent function is
Enter )DIGITS available (see Part 4).
followed by a space and an
integer between 1 and 16
inclusive.
~.~f§.9t :
1. Su.bsequent output of This command has no effect
numbers will show no greater on the precision of internal
number of significant digits calculations, whi.ch is
than indicated. approximately 16 decimal
digits.
~;hf§.9t :
1. Subsequent output of all This affects neither the
kinds, except messages mechanical margin stops nor
between terminals, will be the allowable length of
limited to a line width no input lines.
greater than the number of
spaces indicated.
2.21
W~!Q~ ~bgngg ~Q~~~~g£g This command can be used to
!g~!!:t!.f!£E:.t!Q!!: guard against inadvertently
Enter )WSID changing a stored workspace
followed by a space and a that has just been loaded;
workspace identification. and conversely, to enable
the replacement of a stored
workspace without first
using the drop command, when
the active workspace came
I
from a different source.
(See section on library
control commands.)
11i!ig£.:t:
1. The active workspace will See command LCI for the
assume the specified implications of thi.s.
identification. A lock
associated with the
workspace will be retained.
2.22
system. For example, lengthy calculations do not have to
be completed at one terminal session; student work can be
conducted over a series of short work periods, to suit class
schedules; and mathematical experimentation or the
exploration of ,system models can be done over long periods
of time, at the investigator's convenience.
2.23
the state of another user's private library, or tampering
with public library workspaces which he did not store. He
may, of course, activate a copy of any workspace stored in
the system, if he knows the library number and name (and
password, if required).
2.24
o.e.taile~d D.e.s.c.r..iptian. The term ~oJ:ks.pace. ident.ificat.ion
will be used with the same significance as for the workspace
control commands.
Acrr.I.Q~ NQT.E5.
LC1... Re.=s.tQr:e. a c.QP.}l of the.
ac.tiye. ~Qr:ks~ac.e.:
Enter )SAVE
Effec.t:
1. A copy of the active New workspaces can be stored
workspace will replace the by this command only if the
sco re d workspace with the identification of the active
same identification. workspace has been changed
by WelD.
2. A password associated This forestalls inadvertent
wi th the act.i, ve workspace omission of a lock while
will continue in effect, and actively engaged with a
the stored workspace will be confidential workspace.
locked with this password.
:
R(~s.pa.n.ae TJ:ouble. J:e.porta:
1.. The time of day, date, NOT WITH OPEN DEFINITION
and workspace identification means that the terminal is
will be printed. in function definition mode.
Either close the definition
by entering 'V, or defer the
save operation.
so: SAVED, WS QUOTA USED UP
means that the allotted
number of stored workspaces
has previously been reached.
Unless this is increased,
the workspace can be stored
only by replacing a
workspace already stored.
CONT1NUE may be replaced
di.rectly; any other must be
erased first, or the
identification of the active
workspace must be made to
match by WelD.
2 .. 25
NOT SAVED, THIS WS IS
CLEAR WS
results from the fact that
CLEAR WS.cannot be the name
of a stored workspace.
Either change the name by
WelD, or use Lela. I
IMPROPER LIBRARY REFERENCE
means that an attempt was
made either to replace a
stored workspace that is not
under control of the account
number signed on at the
terminal, or to store into a
non-existent library.
INCORRECT COMMAND
2.26
Res.pans.e: Trouble r.:epor.:.ts.:
1. The time of day and date NOT WITH OPEN DEFINITION
will be printed . . means the same as for LCI.
NOT SAVED~ WS QUOTA USED UP
means the same as for LCI.
NOT SAVED~ THIS WS IS
followed by identification
of the active workspace,
means a stored workspace
with the identification used
in the command exists, but
this identification does not
match that of the active
workspace.
IMPROPER LIBRARY REFERENCE
means the same as for LeI.
INCORRECT COMMAND
2.27
INQUIRY COMMANDS
~!f~.91:: None.
2.28
lQ~.s. J:,.!.§.t gsID.§§. Qk glQQg.l
yg.!'.!M.!.§.§:
Enter ) VARS
followed by an alphabetic
character, if desired.
2.29
!Q1~ ~!§~ ID§mQ§~§b!E Qf
g§§!gn~~§g g~QY2:
Enter )GRP
followed by the name of the
group.
I
g§§l2Q!!§~:
1. The names in the group There will be no response if
will be printed. there is no group with the
designated name in the
active workspace.
~!:QYQJ:§
!:§2Q!:t
INCORRECT COMMAND
~!i§g~: None •
.B§'§f>Q!1'§~:
1. The names of halted This display is the ~t9~~
functions will be listed, iDgi~~tQ~; its significance
most recent ones first. and use is explained in Part
With each name will be given 3.
the line number on which
execution stopped. Suspend- I!:QyQ.J:§ !:§2Q~t
ed functions will be INCORRECT COMMAND
distinguished from pendent
functions by an asterisk.
2.30
l~Q.Q... ~i.§.t D5!!.t§Q, iY!lQ.ti.QD.§
~.1t.b ngID~'§ Qi lQ.Q.§.l
Y.~1;'.1.9Ql§.§ :
Enter )SIV
;g;.;b.f~.Qt : None ,.
B!~'§I>QD.§g : I~QYQJ:§ ;£§I2Q;£:!;
1. The response will be the INCORRECT COMMAND
same as for lQS, except that
with each function listed
there will appear a listing
o:E its local variables.
2.31
1Q2£ ~~§t gQ~t§ ~ll Y§§ gng
gQg§§ Qb QQnn§Qt§g Y§§1r:g:
Enter )PORTS
B§§2Qll§§:
1. Port numbers in use will
1',t'QY121~
,t',g]2Q.t'.t
INCORRECT COMMAND
I
be printed with the
associated user code.
;t;ff§g:i;: None.
COMMUNICATION COMMANDS
There are two pairs of commands in this class. One
pair addresses any connected terminal, and one pair
addresses only the system recording terminal.
2.32
If the interaction at a terminal must be interrupted
for a prolonged period while the terminal is still
connected, it is good practice to lock the keyboard so that
a message may be received. This can be done by addressing a
mes s aqe of 1:he proper type to the terminal's own port
number •
Ej~i§.Q,t :
1. The keyboard will lock
while the text is being
transmi t t.e d ,
INCORRECT COMMAND
2.33
~M~~ bgg~gEg ~g~~ ~Q gggi9= See note at CMl.
ng~gg RQ~~ gnQ lQ~~ ~gy=
gQg~g:
Enter )MSG
followed by a port number
and anyone-line text.
~ff§~j;;:
I
1. Same as eMl effect 1.
2. Same as CMI, Effect 2,
except for a prefix H, to
indicate that a reply is
awaited.
3. The keyboard will remain The keyboard can be
locked after the response is unlocked, before receiving a
printed. reply, by means of an
attention signal.
~ff§gt:
1. 2. and 3. Same as CMl.
2.34
~:M1.L 8~lg~§.§ e j;;;§2ft j;;;Q .§Y:§t~HD See note at CMl.
~'§QQ~ging j;§rm!uS!:! gng lQQJs
Js§Y:QQg1~g:
Enter )OPR
followed by any one-line
tiext; ,
~ff§.Qt:
1. 2. and 3. Same as CM2.
INCORRECT COMMAND
2.35
I
PART 3
THE LANGUAGE
3 .. 1
If the variable name and arrow are omitted, the resulting
value is printed. For example:
3x4
12
3.2
II
function, then the expression 3 F 4 must be entered with the
indicated spaces. The exact number of spaces used in
succession is of no importance and extra spaces may be used
fr_ely ..
3.3
TYPE Cause; CORRECTIVE ACTION
DOMAIN
DEFN
Arguments not in the domain of the function.
Misuse of V or 0 symbols:
I
1. V is in some position other than the first.
2. The function is pendent. DISPLAY STATE
INDICATOR AND CLEAR AS REQUIFED.
3. Use of other than the function name alone in
reopeninq a definition.
4. Improper request for a line edit or display.
3.4
If an invalid statement is encountered during execution
of a defined function, the error report includes the
function name and the line number of the invali.d statement.
The recommended procedure at this point is to enter a right
arrow (-+) alone, and then retry with an amended statement.
'I~he matter is treated more fully in the section on Suspended
Function Execution.
3.5
I
Monadic form fB f Dyadic form AfB
Definition Name Name Definition
or example or example
3.7
For operations such as floor and ceiling, and in
comparisons, a "fuzz" of about 1E-13 is applied in order to
avoid anomalous results that might otherwise be engendered
by doing decimal arithmetic on a binary machine.
Two of the functions of Table 3.2, the relations ~ and
= are defined on characters as well as on numbers.
3.8
The factorial function !N is defined in the usual way
as the product of the first N positive integers. It is also
extended to non-integer values of the a rq ument; N and is
equivalent to the Gamma function of N+1.
The function A!B (pronounced A out of B) is defined as
(!B)t(!A)x!B-A. For integer values of A and B, this is the
number of combinations of B things taken A at a time. (It
is related t.o the Complete Beta function as follows:
Beta(P,Q) ++ +Qx(P-1)!P+Q-1.)
1 2 3 4>( 4 3 2 1
4 6 6 4
2+1 2 3 4
3 4 5 6
1 2 3 4["2
2 2 3 4
3.9
dimension zero, also called an Slm12t~ vector. The empty
vector prints as a blank. For example:
14
1 2 3 4
1 2
15
3
10
4 5 I
Empty vector prints as a blank
6-16
5 4 3 2 1 0
2 X10 Scalar applies to all (i.e., 0) elements
of 10, resulting in an empty vector
2 X16
2 4 6 8 10 12
3.10
The act of defining a function neither executes nor
checks for validity the statements in the body; what it does
is make the function name thereafter equivalent to the body.
For example:
T/OL
4 0188786667
~'.!'~'!}9.£1i:D:g.
Statements in a function are normally executed
in the order indicated by the statement numbers, and
executi.on terminates at the end of the last statement in the
sequence. This normal order can be modified by 1>.r.§.D.QD§.§.
Branches make possible the construction of iterative
procedures.
The expression -+4 denotes a 1>!,gD.Q.D to statement 4 and
causes statement 4 of the function to be executed next. In
general, the arrow may be followed by any expression which,
t.o be effective, must evaluate to an integer. This value is
t.he number of the statement to be executed next. If the
integer lies outside the range of statement numbers of the
body of the function, the branch ends the execution of the
function.
If the value of the expression to the right of a branch
a.rrow i.s a non-empty vector, the branch is determined by its
first component. If the vector is empty (i.e., of zero
dimension) the branch is vacuous and the normal sequence is
followed.
3.11
The following examples illustrate various methods of
branching used in three equivalent functions (SUM, SUM1, and
SUM2) for determining S as the sum of the first N integers:
[1J
[ 2J
VSUM
S+O
I+1
I
[ 3J -+4xI$.N Branch to 4x1 (i.e., 4) or to 4xO (out)
[ 4J S+S+I
[5J I+I+1
[ 6J -+3 Unconditional branch to 3
[7J V
N+1
SUM
S
1
N+2
SUM
S
3
N+5
SUM
S
15
VSUMl Equivalent to SUM
[1J S+O
[ 2J I+1
[ 3J -+OxlI>N Branch to O(out) or continue to next
[4J S+S+I line since OX10 is an empty vector
[ 5J I+I+1
[6J -+3 Unconditional branch to 3
[7J V
N+5
SUM1
S
15
VSUM2 Equivalent to SUM
[ 1J S+O
[2J I+O
[3J S+S+I
[4J I+I+1
[ 5J -+3 X1I$.N Branch to 3 or fall through(and out)
[6J V
3.12
bgg.@-.!
.@-1]..9 g.!QR.§.! Y'@-1'..!£l!?]..§1§. A variable is nonnally g1Q!?.£l1
in the sense that its name has the same significance no
matter what function or functions it may be used in.
However, the iteration counter I occurring in the foregoing
function 8UM is of interest only during execution of the
function; it is frequently convenient to make such a
variable 19.Q.§.1.:t:Q £1 iYD.Q.:t:..!.Q.D in the sense that it has
meaning only during the execution of the function and bears
no relation to any object referred to by the same name at
o·ther times. Any number of variables can be made local to a
function by appending each (preceded by a semicolon) to the
function header. Compare the following behavior of the
function 8UM3, which has a local variable I, with the
behavior of the function 8UM2 in which I is global:
'l/8UM3 ;I 'l/8UM2
3.13
~~El!£!~ ~fgYm§nt. A function definition of the form
'IlSPH X
[ 1J SUR+4x3 014159xXxX
[2J 'Il
SPH 2
SUR
50n 26544
SPH 1
SUR
12056636
'IlZ+SP X
[lJ Z+4x3014159xXxX
[2J 'Il
Q+3 xSP 1
Q
37~ 69908
R+2
(SP R)xRf3
33.51029333
3.14
T.D§ !QI'ID§ Q! 9§tiD§Q, tYD.Q!;.!QDR. Functions may be defined
with 2,1, or 0 explicit arguments and either with or without
an explicit result. The form of header used to define each
of these six types is shown in Table 3.3. Each of the six
forms permits the appena.1.ng of semicolons and names to
introduce local variables. The names appearing in anyone
header must all be distinct; e.g., the· header Z+F Z is
invalid.
0 VF VZ+F
1 VF Y VZ+F Y
2 VX F Y VZ+X F Y
Table 3.3: FORMS OF DEFINED
FUNCTIONS
3.15
Q§§ QI g§!~n§g !yngtiQng. A defined function may be used in
the same ways that a primitive function may. In particular,
it may be used within the definition of another function.
For example, the function HYP determines the hypotenuse of a
right triangle of sides A and B by using the square root
function SQRT:
VZ+SQRT X
I
[1J Z+X*o5V
VH+A HYP B
[1J H+SQRT (A*2)+B*2V
5 HYP 12
13
3.16
MECHANICS OF FUNCTION DEFINITION
.E.~.Y.i.s.i.Q.D.
Any statement number (including one typed by the
system) can be overridden by typing [N], where N is any
positive number less than 10000, with or without a decimal
point and with at most four digits to the right of the
decimal point. If N is zero, it refers to the header line
of the function.
3.17
The particular statement on which the closing V appears
is not significant, since it marks only the end of the
definition mode, not necessarily the last line of the
function. Moreover, the closing V may be entered either
alone or at the end of a statement.
Qi.§:gl§:l.During function definition, statement N can be
displayed by overriding the line number with [ND]o After
I
the display, the system awaits replacement of statement N.
Typing [OJ displays the entire function, including the
header and the opening and closing v, and awaits entry of
the next statement; typing [ON] displays all statements from
N onward and awaits replacement of the last statement.
Executing an attention signal will stop any display.
Lin§ §giting. During function definition, statement N can
be modified by the following mechanism:
4!1
1. Type [NOM] where M is an integer.
2. Statement N is automatically displayed and the
carriage stops under position M.
3. A letter or decimal digit or the symbol/may be
typed under any of the positions in the displayed
statement. Any other characters typed in this mode
are ignored. The ordinary rules for backspace and
linefeed apply.
4. When the carriage is returned, statement N is
re-displayed. Each character understruck by a / is
deleted, each character understruck by a digit K is
preceded by K added spaces, and each character
understruck by a letter is preceded by 5xR spaces,
where R is the rank of the letter in the alphabet.
Finally, the carriage moves to the first injected
space and awaits the typing of modifications to the
statement in the usual manne~. The final effect is to
define the statement exactly as if the entry had been
made entirely from the keyboard; in particular, a
completely blank sequence leaves the statement
unchanged.
If the statement number itself is changed during the
editing procedure, the statement affected is determined by
the new statement number; hence statement N remains
unchanged. This permits statements to be moved, with or
without modification.
3.18
~J~.Q.P§llj.D..g
.f.Y.D.9J:i..Q,D ..Q...e.f..iDl..t.i.o.D. If a function R is already
defined, the definition mode for that function can be
re-established by entering VR alone: the rest of the
f unct.Lori header must not be entered. The system responds by
typing [N+1J, where N is the number of statements in R.
Function definition then proceeds in the normal manner.
~g.9ls:~g
J.YD..Q.t..!.9D...6. I f the symbol 'iii' (formed by a V over struck
with a - and called del-tilde) is used instead of V to open
or close a function definition, the function becomes ~Q.c.ke..d.
A locked function cannot be revised or displayed in any way.
Moreover, an error stop within the function will print only
the function name and statement number, not the statement.
Finally, the associated stop control (see next section) and
trace control vectors cannot be changed after the function
is Lo cked ,
3.19
SUSPENDED FUNCTION EXECUTION
3.20
that the current use of funct.ion H was invoked in statement
2 of function G, and that the use of function G was in turn
invoked in statement 3 of F. The * appearing to the right
of H[7] indicates that the function H is suspended; the
functions G and F are said to be Rendent.
)8I
H[ 7] *
G[2]
F[3]
~!.QI? ~Q'!}.t.!'.Q!.
The §.tQI? Y§.Q.:t:QX for a function P is denoted
by S~P. It is set in the same manner as the trace vector
(i.e., by S~P~-I, where the vector I specifies the numbers of
the statements controlled), and stops execution just 1?~.f.QX§
each of the specified statements. At each stop, the
function name and the line number of the statement next to
be executed are printed. After the stop the system is in
the normal suspended state; resumption of execution may
therefore be initiated by a branch.
3.21
HOMONYMS
z X I P J C T A B
G -t -t -t I I I I I I
F I I I -t -t I I I I
Q I -t I I I -t -t I I
R I I I -t I I I I I
G -t -t -t I I I I I I
Global -t -t -t -t -t -t -t -t -t
3.22
name w i.t.hf.n tha.t function. The first latent referent
becomes active when that function is completed, and holds
down t.o the next arrow; and so forth until the state
Lnd i.cat.o r is completely cleared, at which point there are no
longer any latent referents, and all active referents are
global objects.
For example:
1000 CPI 5 4
1215050625
3.23
The casual user of such a function might, however, find
it onerous to remember the positions of the various
arguments and whether the interest rate is to be entered as
the actual rate (e.g., .05) or in percent (e.g., 5). An
exchange of the following form might be more palatable:
CI
I
ENTER CAPITAL AMOUNT IN DOLLARS
0:
1000
ENTER INTEREST IN PERCENT
0:
5
ENTER PERIOD IN YEARS
0:
4
RESULT IS 1215 050625
3.24
An invalid entry in response to request for a quad
input induces an appropriate error report, after which input
is again awaited at the same point. A sys·tem command
entered will be executed, after which (except in the case of
one which replaces the active workspace) a valid expression
will again be awaited. An empty input (i.e., a carriage
return alone or spaces and a carriage return) is rejected
and the system again prints the symbols 0: and awaits input.
The symbols 0: are printed to alert the user to the
type of input expected; they can be changed by the library
function SFEI as described in Part 4.
:N.1Q.~ID<!l
Q.\!tQ.\!t,. The quad symbol appearing immediately to the
left of a specification arrow indicates that the value of
the expression to the right of the arrow is to be printed.
Hence, D+X is equivalent to the statement X. The longer
form D+X is useful when employing multiple specification.
For example, D+Q+X*2 assigns to Q the value X*2 and then
prints the value of X*2.
The page width (measured in characters) may be set to
any value N in the range 30-130 by entering the command
)WIDTH N. It may also be set by the library function WIDTH
which may be used within a defined function. (See Part 4.)
3.25
M~t~~9g~~~9~§ 9Y~P~~. A sequence of expressions separated
by semi-colons will cause the values of the expressions to
be printed, with no intervening carriage returns or spaces
except those implicit in the display of the values.
VCI;A;I;Y
[1J 'ENTER CAPITAL AMOUNT IN DOLLARS'
[ 2J A+-O
[3J 'ENTER INTEREST IN PERCENT'
[ 4J I+-O
[5J 'ENTER PERIOD IN YEARS'
[6J Y+-O
[7J 'RESULT IS ';Ax(1+.01 xI)*YV
RECTANGULAR ARRAYS
3.26
y§gtQ~§, ~!m~n§1Qn, g~t§n~tiQD. If x is a vector, then pX
denotes its dimension. For example, if X+2 3 5 7 11, then
pX is 5, and if Y~'ABC' , then pY is 3. A single character
entered in quotes or in response to a ~ input is a scalar,
not a vector of dimension 1; this parallels the case of a
single number, which is also a. scalar.
M~!:t~1gg§, ~!.:mgn§1Qn,
±:sygl. The monadic function p applied
to an array A yields "the §.i~§ of A, that is, a vector whose
components are the dimensions of A. For example, if A is
the matrix
1 2 3 4
5 6 7 8
9 1.0 11. 12
Scalar 0 1
Vector N 1 1
Matrix M N 2 1
3-Dimensional L M N 3 1
- -
Table 3.4: DIMENSION AND
RANK VECTORS
3.27
The monadic functjon ~gY§l is denoted by a comma; when
applied to any array A it produces a vector whose elements
are the elements of A in row order. For example, if A is
the matrix
2
10 12
4 6
14
8
16
I
18 20 22 24
1 2 3
456
1 2 1
2 1 2
1 0 0
0 1 0
0 0 1
3.28
More generally, if A is any array, then DpA is
equivalent to Dp , A. For example, if A is the matrix
123
456
The expressions opX and 0 3pX and 3 OpX and 0 OpX are
all valid; anyone or more of the dimensions of an array may
be zero.
3.29
JD9~~iEg. If X is a vector and I is a scalar, then XCI]
denotes the Ith element of X. For example, if X+2 3 5 7 11
then X[ 2 J is 3.
If the index I is a vector, then X[IJ is the vector
obtained by selecting from X the elements indicated by
I
successive components of I. For example, X[1 3 5J is
2 5 11 and X [5 4 3 2 1 J is 11 7 5 3 2 and X [ 1 3 ] is 2 3 5.
If the elements of I do not belong to the set of indices of
X, then the expression XlIJ induces an iDg~~ ~rrQr report.
In general, pX[IJ is equal to pI. In particular, if I
is a scalar, then XCI] is a scalar, and if I is a matrix,
then X[IJ is a matrix. For example:
A+' ABCDEFG'
M+4 3p3 1 4 2 1 4 4 1 2 4 1 4
M
314
214
412
414
A[M]
CAD
BAD
DAB
DAD
3.30
In general, pM[I;JJ is equal to (pI),pJ. Hence i f ]
and J are both vectors, then M[I;JJ is a matrix; if both]
and J are scalars, M[I;JJ is a scalar; if I is a vector and
J is a scalar (or vice versa), M[I;JJ is a vector. The
indices are not limited to vectors, but may be of higher
rank. For example, if I is a 3 by 4 matrix, and J is a
vector of dimension 6, then M[I;JJ is of dimension 3 4 6,
and M[J;IJ is of dimension 6 3 4. In particular, if T and P
and Q are matrices, and if R+T[P;QJ, then R is an array of
rank 4 and R[I;J;K;LJ is equal to T[P[I;JJ;Q[K;LJJ.
M+4 3p3 1 4 2 1 4 4 1 2 4 1 4
M
3 1 Lj.
r) tj.
L. 1
Lj. 1 2
L~ 1 1+
M[M; ]
L~ 1 :2
3 1 1+
Lj. 1 I..j.
2 1 1+
:3 1 )+
q. 1 ,+
Lj. 1 4
:3 1 4
2 1 4
L+ 1 4
:3 1 4
L+ 1 4
3.31
Permutations are an interesting use of indexing. A
vector P whose elements are some permutation of its own
indices is called a Q..~J;Jll.\l.t.qt..:lQJl. Q.:f.. QX..<iex.. p P, For example,
3 1 4 2 is a permutation of order 4. If X is any vector of
the same dimension as P, then XCPJ produces a permutation of
X. Moreover, if pP is equal to (pM)[ 1J, then M[P; J permutes
the column vectors of M (i. e., interchanges the rows of M)
and is called a Q.,.o_:LlJm..Il. Q..~:(.m.\l.t.q,t.i.QJl.. Similarly, if p P equals
( pM) [ 2 J, then M [ ; P J is a :('Q.~ R..~m\l.t.qt..i.QJl. of M.
:LIl.ci~~:lI!fl.
Q.Il. ·t;h..~ :L~t:.t... An array appearing to the left of a
specification arrow may be indexed, in which case only the
selected positions are affected by the specification. For
example:
X+2 3 5 7 11
X[1 3J+6 8
K
6 3 8 7 11
The normal restrictions on indexing apply; in
particular, a variable which has not already been assigned a
value cannot be indexed, and an out-of-range index value
cannot be used.
3.32
The index origin remains associated with a workspace;
in particular, the index origin of an active workspace is
not affected by a copy command. A clean workspace provided
on sign-on or by the command )CLEAR is in I-origin. All
definitions and examples in this text are expressed in
l--origin.
bl~~g.y QY~12Y.t.
Character arrays print with no spaces between
components in each row; other arrays print with at least one
space. If a vector or a row of a matrix requires more than
one line, succeeding lines are indented.
FUNCTIONS ON ARRAYS
3 .. 33
If X is a vector of dimension zero, then fiX yields the
identity element of the function f (listed in Table 3.5) if
it exists; if X is a scalar or a vector of dimension 1, then
fiX yields the value of the single element of X.
The result of reducing any vector or scalar is a
scalar.
Times x 1 R L
Plus + 0 R L
Divide ... 1 R
Minus - 0 R
Power * 1 R
Logarithm 6t None
Maximum r - 70237 0 • L R
oE75
Minimum L 7.237 0 0 L R
0E75
Residue I 0 L
Circle 0 None
Out of
, 1 L
Or v 0 L R
And A 1 L R
Nor ¥ None
Nand 1'< . None
Equal = 1 Apply L R
Not equal ;t 0 for L R
Greater > o~ logical R
Not less ~ 1 arguments R
Less < 0 only L
Not greater $ 1 L
Table 3.5: IDENTITY ELEMENTS OF
PRIMITIVE SCALAR
DYADIC FUNCTIONS
3.34
Since +/[1]M scans over the row index of M it sums each
gQ~Ymn vector of M, and +/[2]M sums the ~Q~ vectors of M.
F'or example, if M is the matrix
123
456
1:!:!!!~.!' E!'Q.Q.~9.t-.
The familiar matrix product is denoted by
C+A+.xB. If A and B are matrices, then C is a matrix such
that C[I;J] is equal to +/A[I;]xB[;JJo A similar definition
applies to Af.gB where f and g are any of the standard
scalar dyadic functions.
3.35
Conformability Definition
pA oB oAf.gB requirements Z+-Af.gB
Z+-f/AqB
V Z+-f /A gB
U Z+-f/AgB
U V u=v Z+-f/AqB
V W W Z[I ]+-f / AgB [ ; I]
T u T Z[ I] +-f/ A[ I; ] 9 B
U V W W U=V Z[I]+-f/AgB[ ;I]
T u V T U=V Z[I]+-f/A[I; ]gB
T U V W T W U=V Z[I;J]+-f/A[I;JgB[;J]
Table 3.6: INNER PRODUCTS FOR PRIMITIVE SCALAR
DYADIC FUNCTIONS f AND 9
X+-l3
Y+-l4
XOoXY
1 2 3 4
2 4 6 8
3 6 9 12
XO o2Y
1 0 0 0
1 1 0 0
1 1 1 0
Definition
pA pB p A° 0 gB Z+-A ° . gB
Z+-AgB
V V Z[IJ+-AgB[IJ
u U Z [I J+-A [I JgB
U V U V Z[I;JJ+-A[IJgB[J]
V W V w Z[I;JJ+-AgB[I;JJ
T u T U Z[I;JJ+-A[I;JJgB
U V W U V w Z[I;J;KJ+-A[IJgB[J;KJ
T u V T U V Z[I;J;KJ+-A[I;JJgBCKJ
T u V W T U V w Z[I;J;K;LJ+-A[I;JJgB[K;LJ
Table 3.7: OUTER PRODUCTS FOR PRIMITIVE
SCALAR DYADIC FUNCTION 9
3.36
MIXED FUNCTIONS
3.37
Name Sign l Definition or example 2
Size pA pP ++ 4 pE ++ 3 4 p5 ++ 1 0
3.38
1. Restrictions on argument ranks are indicated by: S for
scalar, V for vector, M for matrix, A for Any. Except as
t.h e first argument of S 1 A or S LA], a scalar may be used
instead of a vector. A one-element array may replace any
scalar.
A+3 3P19
A
1 2 3
1-
4 o 6
7 13 9
1 1~A
1 5 9
3.39
Table 3.9 shows the detailed definitions of
transposition for a variety of cases.
Case pR Definition
R+l~V pV R+V
R+l 2~M pM R+M
R+2 l~M ( pM) [ 2 lJ R[I;JJ+M[J;IJ
R+l l~M L /pM R[IJ+M[I;IJ
R+l 2 3~T pT R+T
R+l 3 2~T (pT)[l 3 2J R[I;J;KJ+T[I;K;JJ
R+2 3 l~T (plJ ) [ 3 1 2 J R[I;J;KJ+T[J;K;IJ
R+3 1 2~T (pT)[2 3 lJ R[I;J;KJ+T[K;I;JJ
R+l 1 2~T (L/(pT)[l 2J),(pT)[3J R[I;JJ+T[I;I;JJ
R+l 2 l~T (L/(pT)[l 3]),(p27 ) [ 2 J R[I;JJ+T[I;J;IJ
R+2 1 l~T (L/(pT)[2 3]),(pT)[lJ R[I;JJ+T[J;I;IJ
R+l 1 l~T L /p T R[IJ+T[I;I;IJ
Table 3.9: TRANSPOSITION
3.40
For example, if pX is 3 4 and J is 2, then K must be of
dimension 3 and Z[I;] is equal to K[I]~X[I;]o If J is 1,
then pK must be 4, and Z[;I] is equal to K[I]¢X[;I]. If X is
a three-dimensional array, then K must be a matrix or a
scalar. For example:
M 0 1 2 3¢[1]M 1 2 3<P[2]M
1 2 3 4 1 6 11 4 2 3 4 1
5 6 7 8 5 10 3 8 7 8 5 6
9 10 11 12 9 2 7 12 12 9 10 11
A ¢[1]A ¢[2]A
123 456 321
456 123 654
~~9!!1P.!'~§'§.
The expression U / X denotes .9QIDP.!"§.§§i-.9Il of X by U.
If U is a logical vector (comprising elements having only
t.he value s 0 or 1) and x i s a vector of the same dimens ion,
then U/X produces a vector result of +/U elements chosen
from those elements of X corresponding to non-zero elements
of U. For example, if X+2 3 5 7 11 and U+1 0 1 1 0 then
U / Xis 2 5 7 and ('" U) / xis 3 11 0
3.41
If
M is a matrix, then U/[1]M denotes compression
the first coordinate,
~.!Q.!}g that is, the compression
operates on each column vector and therefore deletes certain
rows. It is called £Q1YIDD compression. Similarly, U/[2]M
(or simply U/M) denotes ~g~ compression. The result in
every case is a matrix. As in reduction, U/M denotes
compression along the last coordinate, and UfM denotes
compression along the first.
~~EE.!}g. Expansion is the converse of compression and is
denoted by U\Xo If Y+U\X, then U/Y is equal to X and (if X
is an array of numbers) (~U)/Y is an array of zeros. In
other words, U\X expands X to the format indicated by the
Q.!}§§ in U and fills in zeros elsewhere. To be conformable,
+/U must equal pX.
3.42
~QgQ~~. The ~n£Q~~ function RTN denotes the representation
of the scala.r N in the base-R number system. Thus, if
Z+RTN, then (x/R),IN-RJ..Z is equal to zero. F'or example,
2 2 2 2 T 5 is 0 1 0 1 and 2 2 2 T 5 is 1 0 1 and 2 2 T 5 is
o 1. The dimension of RTN is the dimension of R. The
encode function is also called ~§Q~§§§nt~tiQn.
1ABCDEFGH'1'GAFFE'
7 1 665
~~~znQ~!:.§!h!.12.
The function X E Y yields a logical array of the
same dimension as X. Any particular element of XEY has the
value 1 if the corresponding element of X belongs to Y, that
is, if it occurs as some element of Y. For example,
(17)E3 5 is equal to 0 0 1 0 1 0 0 and 'ABCDEFGH'E'COFFEE'
equals 0 0 1 0 1 1 0 o.
If the vector U represents the universal set in some
finite universe of discourse, then UEA is the characteristic
of the set A, and the membership function is therefore also
called the g)-1s.~g(;~:!;~~i.§.ti.Q function.
The size of the result of the function E is determined
by the size of the left argument, whereas the si.ze of the
result of the dyadic function 1 is determined by the size of
the right argument. However, the left arguments of both
frequently play the role of specifying the universe of
d i acour s e ,
3.43
~g~~ gng Q~Q~. If V is a vector and S is a scalar between 0
and pV, then StV takes the first S components of V. For
example, if V+17, -then 3tV is 1 2 3 and OtV is 10, and 8tV
yields a domain error.
If S is chosen from the set -lPV, then StV takes the
last Is elements of V. For example, 3tV is 5 6 7.
If A is an array, then WtA is valid only if W has one
element for each dimension of A, and WeI] determines what is
to be taken along the Ith coordinate of A. For example, if
A + 3 4Pl12, then 2 -3tA is the matrix
234
678
3.44
~~§9:1.. The function M? N produces a vector of dimension M
obtained by making M random selections, without replacement,
from the population IN. In particular, N?N yields a random
permuta.tion of order N. Both arguments are limited to
scalars or one-element arrays.
~;Q:t.nm§nt§..
The lamp symbol A, formed by overst.riking nand
0, signifies that what follows it is a comment, for
illumination only and not to be executed; it may occur only
as the first character in a statement, but may be used in
defined functions.
MULTIPLE SPECIFICATION
Specification (+) may (like any other function) occur
repeatedly in a single statement. For example, the
execution of the statement Z+XxA+3 will assign to A the
value 3, then multiply this assigned value of A by X and
a.ssign the resulting value to Z.
Multiple specification is useful for initializing
variables. For example:
X+Y+1+Z+0
3.45
SYSTEM DEPENDENT FUNCTIONS
Moreover, since the functions I21 and I22 can, like all
of the I-beam functions, be used within a defined function,
they can be used to make the execution dependent upon the
space available or the computer time used.
3.46
X Definition of IX
19 Accumulated keyingtime (time during which the keyboard
has been unlocked awaiting entries) during this session.
20 The time of day.
2:1. The central computer time used in this session.
22 The a.mount of available space (in bytes).
221 The number of terminals currently connected.
24 The time at the beginning of this session.
2~) The date.
26 The first element of the vector I27.
27 The vector of statement numbers in the state indicator.
NOTES
1. All times in 1f60 seconds
2. Date is represented by a 6-digit integer; successive
digit pairs represent month, day, and year.
3. I27 yields a vector; all other results are scalars.
\1MULTDRILL N;X;Y;TIME
[1 J D+Y+?N
[2J TIME+r19
[3 J X+D
[4J TIME+(I19)-TIME
[5J -+8XlX~X/Y
[ 6J ' TIME: '; 2 t 60 60 60 T TIME
[7J -+1
[8J 'WRONG, TRY AGAIN'
[9J -+3\1
MULTDRILL 12 12
6 3
0:
18
TIME: 0 3
4 5
30
WRONG, TRY AGAIN
0:
3.47
Such a drill could be expanded to accumulate statistics of
the student's response times or to use some function of the
response times to control the difficulty of the questions
posed.
3.48
PA.RT 4
LIBRARY FDNCTIONS
)LOAD 1 ADVANCEDEX
ADVANCEDEX SAVED 07/1L~/(-,8
)FNS
AH ASSOC BIN COMB DTH ENTER F FC
G'C GCD GCV HILB HTD IN INV INVP
INl LFC LOOKUP PALL PER PERM PO POL
POLY POLiB RESET TIME TRU'TH ZERO
DESCRIBE
4.1
)LOAD 1 PLOTFORMAT
PLOTFORUqT SAVED 07/20/68 31 007 027
)FNS
AND DESCRIBE DFT EFT PLOT VS
DESCRIBE
4.2
HOWFORMAT
THE FUNCTIONS DFT AND EFT WILL ARRAY NUMBERS IN DECIMAL AND
EXPONENTIAL FORM, RESPECTIVELY, FOR TABULAR OUTPUTo THEY
MAY BE USED TO GENERATE IMMEDIATE OUTPUT, OR '1 0 STORE AN
1
A SINGLE INTEGER~
DFT: SPECIFIES THE NUMBER OF DIGITS TO THE RIGHT OF
'PHE DECIMAL POINT IN DECIMAL FORMAT.
EF'11~ SPECIFIES THE NUMBER OF SIGNIFICANT DIGITS IN
EXPONENTIAL FORMATo ONE DIGIT ALWAYS APPEARS TO THE
LEFT OF THE DECIMAL POINTo COLUMNS WILL BE SPACED
UNIFORMLY, WITH SPACING SUCH THAT THERE WILL BE TWO
SPACES BETWEEN THE CLOSEST NUMBERS.
A. PAIR OF IN'l'EGERS: .THE FIRST SPECIFIES THE TOTAL
NUMBER OF SPACES TO BE ALLOCATED TO EACH COLUMN, AND
THE SECOND IS USED AS ABOVE.
DFT: THE FIRST NUMBER MUST BE AT LEAST TWO LARGER
'l'HAN THE SECOND
0
4.3
HOWPLOT
4.4
AUXILIARY FUNCTIONS: THE FUNCTIONS AND AND VS CAN BE
USED TO GENERATE THE RIGHT ARGUMENT IN THE PROPER FORM
FOR PLOTo FOR EXAMPLE~
20 PLO'P Z AND Y VS X
)LOAD 1 APLCOURSE
APLCOURSE' SAVED 07/19/68
)FNS
B1X CHECK DESCRIBE DIM DRILL DYAD1 DYAD2
EASY EASYDRILL FORM FUNDRILL GET INPUT
INTER LOG QUES RANDOM REDSCAPATCH REPP
SETPARAMETERS TEACH TRACE
DESCRIBE
TEACH
EASYDRILL
SYNTAX DESCRIPTION
TEACH AN EXERCISE IN APL FUNCTIONS USING SCALARS
AND VECTORS 0 THE FUNCTION PRIN'1. OUT THE 1S
4.5
NOTE: FOR EITHER FUNCTION, A RESPONSE OF - PLEASE - WILL
DISCLOSE THE PROPER ANSWERo A RESPONSE OF - STOP - WILL
TERMINATE THE DRILLo
TEACH
ARE YOU ALREADY FAMILIAR WITH THE INSTRUCTIONS? (TYPE
Y FOR YES AND N FOR NO o )
0:
2
TRY AGAIN
0:
3
0+7
0:
STOPSHORT
4.6
)LOAD 1 WSFNS
WSFNS SAVED 07/20/68 31 025 023
)FNS
DELAY DESCRIBE DIGITS ORIGIN SETLINK SFEI WIDTH
DESCRIBE
VF X
[ 1J X+ 0 RIGI
N X
[2J G
[3J X+ORIGIN xv
!2E.§'QB.l.E.l.l.Qli.
Z+-SETLINK X SETS THE VALUE OF THE LINK IN THE CHAIN OF
NUMBERS GENERATED IN THE USE OF .THE ROLL AND
DEAL FUNCTIONS THE EXPLICIT RESULT PRODUCED
0
4.7
)LOAD 1 TYPEDRILL
TYPEDRILL SAVED 07/14/68
)FNS
DESCRIBE IN INSTRUCTIONS MATCH PR'l' QUERY
S'TATISTICS TIME TYPEDRILL WS
DESCRIBE
THE MAIN FUNCTION IN THIS WORKSPACE IS TYPEDRILL; ALL
OTHERS ARE SUBFUNCT10NS. TO USE IT, SIMPLY ENTER
TYPEDRILL
4.8
TYPEDRILL
CONTROL WORDS ARE: ENTER, DRILL, STAT, AND STOP.
Y() U ARE' INC 0 NTR 0 L S TA l' E
ENTER
NOW IS THE TIME FOR ALL GOOD MEN TO COME TO
I SING OF OLAF GLAD AND BIG
X-E-I rpxQ+Y*R~ 5
YOU ARE IN CONTROL ST A.1'E
DRILL
NOW IS THE' TIME FOR ALL GOOD MEN TO COME TO
NOW IS THE TIME OFR ALL GOOD MEN TO COME TO
A
NOW IS THE TIME FOR ALL GOOD MEN TO COME TO
115 09
X-E-I r pxQ+Y*R~ 5
X-f-I r pxQ+Y*R~ 5
19 09
4.9
Appendix A
)177E)
010) 1903:2 036 07/03/68 JANET
A P L \ 360
FUNDAMENTALS
A.I
x Y Entry of invalid expression
SYNTAX ERROR Shows type of error committed
X Y Retypes invalid statement with
1\ caret where execution stopped
XY Multi-character name (not Xxy)
VALUE ERROR
XY XY had not been assigned a value
1\
SCALAR FUNCTIONS
Dyadic maximum
12
Monadic ceiling
24
X+15 Index generator function
X
1 2 345
1 0 Empty vector
prints as a blank line
Y+5-X All scalar functions extend
Y to vectors
43210
Xry
4 334 5
X~y Relations produce
1 1 0 0 0 logical (0 1) results
01 Pix1
3 0141592654
0+1 2 Pi+1 2
3 0141592654 1 0570796327
X+45 90
oX+180 Conversion of X to radians
0 07853981634 1.570796327
101 Sin 1
0 08418709848
201 2 Cos 1 2
0 05403023059 0 04161468365
301 Tan 1
1 0557407725
-301 Arctan 1
0 07853981634
Oo+y
o 0 08660254038
701 2 Tanh 1 2
0 0761594156 0 09640275801
A.2
DEFINED FUNCTIONS
1
\/H A Like G but has no explicit result
[1J P+(A>O)-A<O P is a global variable
[2J \/
H 6
P
1
Y+H-6 H has no explicit result
VALUE ERROR and hence produces a value
Y+H -6 error when used to right
of assignment
\/Z+-FAC N;.I FAC is the factorial function
[1J Z+1
[2J I+O
[3J L1:I+I+1 Ll becomes 3 at close of def
[4J -+oxl.I>N Branch to 0 (out) or to next
rs i Z+ZxI
[6J -+L1. Branch to Ll (that is, 3)
[ 7J \/
FAC 3
6
FAC S
120
T!1F'AC+3 S Set trace on lines 3 and 5 of FAC
X+FAC 3
FAC[3J 1 Trace of FAC
FAC[SJ 1
FAC[3J 2
FAC[SJ 2
FAC[3J 3
FAC[SJ 6
FAC[3J 4
T!1F'AC+O Reset trace control
A.3
HECHANICS OF
FUNCTION DEFINITION
A.4
VZ+ABC X A function to show line editing
[1] Z+(33 xQ+(R x 5 ) - 6 A line to be corrected
[2] [ 1[]9 J Initiate edit of line I
[ 1] Z+(33xQ+(R x 5 ) - 6 Types line, stops ball under 9
/ 1 /1 Slash deletes, digit inserts spaces
[ 1] Z+(3 xQ)+(T x 5 ) - 6 Ball stops at first new
[2 ]I V space. Then enter) T
FAC 5 FAC still defined
120
)ERASE FAC Erase function FAC
FAC 5 Function FAC no longer exists
SYNTAX ERROR
FAC 5
A
VZ-f-BIN N An (erroneous) function for
[1J LA~Z+(Z,O)+O,Z binomial coefficients
[2J -+LAxN"?pZV
B1N 3
VALUE ERROR
BIN[1J LA:Z+(Z,O)+O,Z Suspended execution
A
Z+1 Assign value to Z
-+1 Resume execution
1 3 3 1 Binomial coefficients of order 3
BIN 4
VALUE ERROR Same error (local variable Z
BIN[1] L1:Z+(Z,O)+O,Z does not retain its value)
A
VBIN[o1JZ+1V Insert line to initialize z
)SI Display state indicator
BIN[1J * Suspended on line I of BIN
-+1 Resume execution (BIN now correct)
1 1+ 6 4 1
VBIN[OJV Display revised function
V Z+BIN N and close definition
[1J Z+1
[2J LA:Z+(Z,O)+O,Z
[3J -+LAxN"?pZ
S~BIN+2 Set stop on line 2
Q+BIN 3 Execute BIN
A.5
INPUT AND OUTPUT
RECTANGULAR ARRAYS
P+-2 3 5 7
pP Dimension of P
4
T·~' OH MY' Character vector
p.T
5
P,P Catenation
2 3 5 7 2 3 5 7
T,T
OR MYOH MY
T,P
DOMAIN .ERROR Characters cannot be catenated
T,P wi th numbers
1\
A.6
M+2 3p2 3 5 '7 11 13 Reshape to produce a 2x3 matrix
M Display of an array of rank >1
is preceded by a blank line
:2 3 5
'7 11 13
2 4p T A 2x4 matrix of characters
OH M
YOH
6pM A matrix reshaped to a vector
2 3 5 '7 :1.1 13
,M Elements in row-major order
2 3 5 7 :1.1 13
P+,M
P[3J Indexing (third element of p)
ot;
P[l 3 5J A vector index
2 5 11
P[13J The first three elements of P
2 3 5
P[ pP J Last element of P
:L3
M[1;2J Element in row 1, column 2 of M
3
M[l;J Row 1 of M
1")
L.. 3 5
M[l 1;3 2J Rows 1 and 1, columns 3 2
5 3
5 3
A+' ABCDEFGHIJKLMNOPQ' The alphabet to Q
A [MJ A matrix index produces
a matrix result
BeE
GKM
A[M[l 1;3 2JJ
BC
EC
M[1;J+15 3 12 Respecifying the first row of M
M
15 3 12
7 11 13
A.7
Q+-3 1 5 2 4 6 A permutation vector
P[QJ Permutation of P
5 2 11 3 7 13
Q[Q] A new permutation
5 3 4 1 2 6
P[3] Present index origin is 1
5
)ORIGIN 0 Set index origin to 0
WAS 1
P[3]
7
P[O 1 2 ] First three elements of P
2 3 5
1 5 Result of index generator
0 1 2 3 4 begins at origin
)ORIGIN 1
WAS 0
1 5
1 2 3 4 5
FUNCTIONS ON ARRA.YS
7 9 4
5 8 1
1 5 7
N
1 4 1
4 7 6
9 8 5
M+N Sum (element-by-element)
8 13 5
9 15 7
10 13 12
A.8
MrN Maximum
7 9 4
5 8 ' 6
9 8 7
M5N Comparison
0 0 0
0 0 1
1 1 0
+/V Sum-reduction of V
10
x/V Product-reduction
14
+/ [ 1 JM Sum over first coordinate of M
13 22 12 (down columns)
+/ [ 2 JM Sum over second coordinate of M
(over rows)
20 14 13
+/M Sum over last coordinate
20 14 13
riM Maximum over last coordinate
987
X+1 ry 5
+/(1 20X)*2 Sin squared plus Cos squared
1
0/1 2,X Sin Cos X
0 007067822453
Y=10X An identity
1
Mt 0 <N Ordinary matrix (+ox inner)
product
79 123 El1
46 84 :;8
84 95 66
Mt o5N An inner product
111
111
2 3 2
Mt 0 xV +ox inner product with vector
51 25 56 right argument
A.9
V
2 1 7
V oX 1 5 Outer product (times)
2 4 6 8 10
1 2 3 4 5
7 14 21 28 35
Vo 0 s 19 Outer product
0 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1
0 0 0 0 0 0 1 1 1
v-. xM An outer product of rank 3
14 18 8
10 16 2
2 10 14
A blank line between planes
7 9 4
5 8 1
[-
1 o 7
49 63 28
35 56 7
7 35 49
MIXED FUNCTIONS
7 5 1
9 8 5
4 1 7
~M Ordinary transpose of M (monadic)
7 5 1
9 8 5
4 1 7
A.IO
T+2 3 4Pl24 An array of rank 3
T
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
17 18 19 20
21 22 23 24
5 17
6 18
7 19
8 20
9 21
10 22
11 23
12 24
1 1G(M Diagonal of M
787
1 1 2G(T Diagonal section in first
two coordinates of T
1 2 3 4
17 18 19 20
Xf-O(0,15)+6
)DIGITS 4 Set number of output digits to 4
W;1S 10
G(1 2 3 0
00X
A.II
Q
1 4 3 4 5 4 2 1 4 2
3¢Q Rotate to left by 3 places
4 5 4 2 1 4 2 1 4 3
-3¢Q Rotate to right by 3 places
1 4 2 1 4 3 4 5 4 2
0 1 2¢[1]M Rotate columns by
different amounts
7 8 7
5 5 4
1 9 1
-2¢[2]M Rotation of rows all
by 2 to right
9 4 7
8 1 5
5 7 1
1 2 3¢M Rotation of rows
9 4 7
1 5 8
1 5 7
¢Q Reversal of Q
2 4 1 2 4 5 4 3 4 1
¢[ 1 JM Reversal of M along
first coordinate
1 5 7
5 8 1
7 9 4
<pM Reversal along last coordinate
4 9 7
1 8 5
7 5 1
A.12
U+Q>4
U
o 0 0 0 1 0 0 000
UIQ Compression of Q by logical
5 vector U
( "'U ) I Q Compression by not U
1 4 344 2 142
+IUIQ
5
1 0 1/[1]M Compression along first
coordinate of M
794
157
1 0 11M Compression along last
coordinate
7 q.
5 1
1 7
(,M>5)j,M 1M is 7 9 4 5 8 1 1 5 7
7 Sl 8 7 All elements of M which exceed 5
v'+l 0 1 0 1
V\ 1 3 Expansion of iota 3
10203
V\M Expansion of rows of M
7 0 9 0 4
5 0 8 0 1
10507
V\ 'ABC' Expansion of literal vector
ABC inserts spaces
10.11 7 7 6 Base 10 value of vector 1 7 7 6
1776
8.11 7 7 6 Base 8 value of 1 7 7 6
1022
(4pl0)T1776 4 digit base 10 representation
1 7 7 6 of number 1776
(3pl0)T:L776 3 digit base 10 representation
776 of 1776
10 10T1776
7 6
10T1776
6
24 60 60.11 3 25 Mixed base value of 1 3 25
3:305 (time radix)
24 60 60T3805 Representation of number 3805
1 3 25 in time radix
2.11 0 1 1 0 Base 2 value
A.13
M
7 9 4
5 8 1
1 5 7
)ORIGIN 0
WAS 1
M[2;0] Indexing of matrix in a-origin.
1 Note relation to indexing of
( ,M)[(pM).l2,0] ravel of M
1
)ORIGIN 1 Restore I-origin
WAS 0
P
1-
2 3 J 7 11 13
P17 Index of 7 in vector P
4 7 is 4th element of P
P16 6 does not occur in P, hence
7 result is l+pP
P14 5 6 7
7 3 7 4
Q+5 1 3 2 4 A permutation vector
R+Q 1 1 PQ R is the permutation inverse to Q
R
24351
Q[R]
1 2 345
A+'ABCDEFGHIJKLMNOPQ'
A+A, , RSTU VWXY Z '
A A is the alphabet
ABCDEFGHIJKLMNOPQRSTUVWXYZ
A1 ' C' Rank of letter C in alphabet is 3
3
J+Al 'CAT'
J
3 1 20
A[J]
CAT
A.14
M+3 5p'THREESHORTWORDS' A matrix of characters
M
THREE
SHOR'JI
WORDS
J+AlM Ranking of M produce s a matrix
J
20 8 18 5 5
19 8 15 18 20
23 15 18 4 19
A[J] Indexing by a matrix produces
a matrix
THREE
SHORT
WORDS
3?5 Random choice of 3 out of S
512 without replacement
6?5
DOMAIN ~'Rl?OR
6?5
A
X+8?8 A random permutation vector
X
4 6 7 2 5 183
~X Grading of X
6 4 8 1 5 2 3 7
X[!X] Arrange in ascending order
1 2 3 4 5 6 7 8
X[VX] Arrange in descending order
876 5 432 1
V+ A E: ' NOW IS TH E TIME' Membership
'01'[1+V]
00001001100011100011001000
VIA
EHIMNOSTW
(18)E3 7 5
o 0 1 0 1 0 1 0
A.IS
Appendix B
ADVANCED EXAMPLES
P+(P,O)+O,P
D+P+(D+P,O)+D+O,P
)LOAD 1 ADVANCEDEX
AD VANCBDEX SA VED 07/20/68 28 012 010
)FNS
A.H ASSOD BIN COMB DTH ENTER F FC
CC GCD GCV HILB HTD IN INV INVP
IN1 LFC LOOKUP PACK PALL PER PERM PO
POL POLY POLYB RESET TIME TRUTH UNPACK ZERO
)VARS
DAH DASSOC DBIN DCOMB DDTH DENTER DESCRIBE
DF DFC DGC DeCD DGCV DHILB DHTD DIN
DINV DINVP DIN1 DLFC DLOOKUP DPACK DPALL DPER
DPERM DPO DPOL DPOLY DPOLYB DTIME DTRUTH DUNPACK
DZERO TIMER
DESCRIBE
B.I
DPACK
THE FUNCTIONS PACK AND UNPACK ILLUSTRATE THE USE OF THE
ENCODE AND DECODE FUNCTIONS IN TRANSFORMING BETWEEN A FOUR-
NUMBER ENCODING OF SERIAL NUMBER (1 TO 9999), 'MONTH, DAY,
AND YEAR, AND A SINGLE-NUMBER ENCODING OF THE SAME DATAo
V' PACK[ 0]\7
\7 Z+PACK X
[1] Z+ 10000 12 31 100 iX-1
\7
\7UNPACK[O]\7
\7 Z+UNPACK X
[1] Z+1+ 10000 12 31 100 TX
\7
P+PACK 2314 7 17 68
P
86063867
UNPACK P
2314 7 17 68
UNPACK PACK 2311 9 21 72
2311 9 21 72
PACK UNPACK 92137142
92137142
PACK 1 1 31 1
3000
UNPACK 3000
1 1 31 1
B.2
DENTER
VENTER[OJI] VLOOKUP[OJI]
V EN'fER;X I] LOOKUP;X;J
[ 1J 'ENTER NAME' [lJ ,?'
[ 2] X+-,~ [ 2J X+', ~
[ 3J -~"OX10=pX [ 3J -+OX10=pX
[ 4] NAMES+NAMES,X [ 4J J+(((l+Pl)--l+Pl)=pX)/l-l+pPl
[5J Pl+-Pl, p NAMES [5J J+(NAMES[Pl[JJoo+lpX]A o = X ) / J
[ 6] 'ENTER DATA' [ 6J -+(0 1 =pJ)/ 10 8
[ 7J DATA+DATA , ~ [7J -+l,PU+'MORE THAN ONE SUCH NAME'
[8J P2+P2,pDATA [ 8J DATA[P2[JJ+l-/P2[1 0 +JJJ
[9J t, [ 9J -+1
[10J [10J 'NO SUCH NAME'
I] [llJ -+1
I]
I]RESET[OJI]
V RESET
[lJ NAMES+DATA+pPl+P2+0
RESET
E'NTER
ENTER NAME
J ARMSTRONG
0
ENTER DATA
PRESIDENT
ENTER NAME
H LEVINE
0
ENTER DATA
VICE-PFr'ESIDENT
EN1 1 B R NAME
LOOKUP
?
H LEVINE
Q
VICE-PRESIDEN.T
?
L YAVNER
0
NO SUCH NAME
?
B e3
DIN
THE FUNCTIONS IN AND IN1 TAKE TWO ARGUMENTS; THE FIRST IS A
WORD (IQEQ, A VECTOR) WHOSE OCCURRENCES IN THE SECOND
ARGUMENT ARE TO BE DETERMINED, THE RESULT IS A VECTOR OF
INDICES OF THE FIRST LETTER OF EACH OCCURRENCE. THE
FUNCTION IN DETERMINES dLL OCCURRENCES, WHEREAS IN1
DETERMINES ONLY ALL NON-OVERLAPPING OCCURRENCES BY FIRST
APPLYING THE FUNCTION IN AND THEN SUPPRESSING ALL OVERLAPS 0
VIN[OJv
V Z+A IN B;J
[lJ J+(A[lJ=B)/lpB
[2J J+(J~l+(pB)-pA)/J
[ 3J Z+ ( B [ J 0 0 + - 1 + 1 P A J 1\, =A ) / J
V
VIN1[OJv
V T+A IN1 B
[ 1J T+A IN B
[ 2J + 2 x J < p T+ ( ,. . , ( 1 P ']1) E J + 1 + ( ( p A) > I- /[ 1 J ( 2 , 1 + p T ) p T) 1 1 ) / T
V
W+' THE'
T+'THE MEN THEN WENT HOME Q '
W IN T
1 9
W IN1 T
1 9
'ABA' IN 'NOWABABABABABABABA'
4 6 8 10 12 14 16
'ABA' IN1 'NOWABABABABABABABA'
4 8 12 16
DTRUTH
THE FUNCTION TRUTH PRODUCES THE MA'l'RIX OF ARGUMENTS OF THE
TRUTH TABLE FOR N LOGICAL VARIABLES.
VTRUTH[OJv
V Z+TRUTH N
[1J z+2IL(-1+12*N)oQ+2*N-1N
V
TRUTH 3
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1
( TRUTH 3)+oxcP2* 1+13
-
0 1 2 3 4 5 6 7
B.4
DGCD
THE FUNCTIONS GCD AND GC EACH EMPLOY THE EUCLIDEAN ALGORITHM
TO PRODUCE THE GREATEST COMMON DIVISOR. GCD EMPLOYS TWO
SCALAR ARGUMENTS, WHEREAS GC EMPLOYS A SINGLE ARGUMENT WHICH
IS EXPECTED TO BE A TWO-ELEMENT VECTOR 0
VGCD[OJv
V Z+M GCD N
[lJ Z+M
[2J M+MIN
[3J N+Z
[4J ~O~M
VGC[OJv
V Z+GC M
[lJ ~O~l~M+~M[lJ,Z+I/M
VGCV[OJv
V Z+GCV W;A
t i : ~l~pW+Z,(A~O)/A+(Z+L/W)IW
V
84 GCD 90
6
90 GCD 84
6
GC 90 8 1+
6
CCV 90 84
6
GCV 90 84 105
3
DBIN
THE FUNCTION BIN PRODUCES ALL BINOMIAL COEPFICIEN.TS UP TO ORDER N
VBIN[OJv
V Z+BIN N
[lJ Z+L~(O,lN)oo!O,lN
V
BIN 4
1 0 000
1 1 0 0 0
1 2 1 0 0
1 3 310
1 4 6 4 1
:8.5
DPOLY
THE FUNCTIONS POLY, POL, PO, AND POLYB EACH EVALUATE A
POLYNOMIAL (OR POLYNOMIALS), WHOSE COEFFICIENTS ARE
DETERMINED BY THE FIRST ARGUMENT, AND WHOSE' POINT (OR
POINTS) OF EVALUATION IS DETERMINED BY THE SECOND ARGUMENT.
THE COEFFICIENTS ARE IN ASCENDING ORDER OF ASSOCIATED
POWERS 0
VPOLY[OJv VPOLYB[OJV
V Z+C POLY X V Z+C POLYB X
[ 1J Z++/CxX* 1+1P,C [1J Z+Xl<PC
V V
VPOL[OJV VPO[OJv
V Z+C POL X V Z+C PO X
[ 1J Z+(X* - 1+1P,C)+.xC [1J Z+(Xo o*
- 1+11ppC)+oxC
V V
C+1 2 3 4
C POLYB 3
142
(C POLY 3)I\Q=(C POLYB 3) , (C POL 3),C PO 3
1
C PO 1 2 3 4 5 6
10 49 142 313 586 985
O+M+ts?BIN 5
1 1 1 1 1 1
0 1 2 3 4 5
0 0 1 3 6 10
0 0 0 1 4 10
0 0 0 0 1 5
0 0 0 0 0 1
LM PO 1 6
1 2 4 8 16 32
1 3 9 27 81 243
1 4 16 64 256 1024
:1 5 25 125 625 3125
1 6 36 216 1296 7776
:1 7 49 343 2401 16807
B.6
DTIME
THE FUNCTION TIME YIELDS THE AMOUNT (IN MINUTES, SECONDS,
AND 60THS OF A SECOND) OF CPU TIME USED SINCE ITS LAST
PREVIOUS EXECUTION. IT IS USEFUL IN MEASURING THE EXECUT10N
'TIMES OF OTHER FUNCTIONS THE VARIABLE 'TIMER' IS ASSIGNED
0
DCOMB
VFC[OJv
V C+FC N ;.A;B
ri i B+(lN)oo+NpO
[2J A+(lN)oo+lN
[3J C+(2,NxN)p(,B)"A
[4J C+~(C[2;J~N)/C
V
VLFC[OJv
V Z+LFC N
[lJ Z+'ABCDEFGHIJKLMNOPQRSTUVWXYZ'[FC NJ
V
TIME
0 0 35
TIME
0 0 2
COMB 4 FC 4 LFC 4
1 2 1 2 AB
1 3 1 3 AC
2 3 1 4 AD
1 4 2 3 Be
2 4 2 4 BD
3 4 3 4 CD
'PIME TIME TIME
0 0 :1.2 0 0 8 0 0 7
B.7
Z+COMB 15 Z+FC 15
pZ pZ
105 2 105 2
TIME TIME
0 1 4 0 0 29
DDTH
VDTH[OJv
V R+DTH X
[ 1J R+ , ( , 0123456789 AB CD EF' ) [ 1 +( 8 p 16 ) T X J
VHTD[OJv
V R+HTD X
[1J R+((8-p,X)p'0'),X
L2 J R+L ( 16.L -1 + ' 0123456789 AB CD EP , 1 R) - ( 2 * 32 ) xR [1 J E ' 8 9AB CDE F'
[3J ~4x~A/XE'0123456789ABCDEF'
[ 4J R+' ,
[5 J 'NUMBER IS NOT HEX'
VAH[OJv
V R+A AH B
[1J R+DTH(H'1'D A)+HTD B
Z+DTH 1776
Z
000006FO
HTD Z
1776
Z AH Z
OOOOODEO
HTD Z AH Z
3552
HTD '000006FO'
1776
HTD '90000000'
1879048192
HTD '00049HFG'
NUMBER IS NOT HEX
B.8
DZERO
VZERO[DJV'
V Z+TOL ZERO B;T
[lJ +OxlTOL~IT+F Z+005x+/B
[2J +1,B[2~(0<T)~0<F BJ+Z
V'
V'F[OJV'
V Z+F X
[lJ Z+ 20 18 3 5 1 PO X
\I
n-r- -4+ 19
3 2 -1 0 1 2 3 4 5
F X
169 12 29 20 3 4 7' 36 145
'TIME
o 1 1. 9
D+R+1E-6 ZERO 2 1
1 08451.21413
'l'IME
o 2 216
F R
7 01 L+1 4 0 81 4E 7'
'l'IME
o 0 :;;,
D+FD+R+1E-10 ZERO 1 2
1 026397094
-10813305062E 11
'TIME
o 3 46
D+FD+R+1E-6 ZERO 1 2
1 0263970852
-8051888359E 7'
'TIME
o 2 13
B.9
DHILE
THE FUNCTION HILE PRODUCES A HILBERT MATRiX OF ORDER No
VHILE[OJv
V Z+HILE N
t i : Z++-l+(lN)oo+lN
HILE 3
1 005 003333333333
0 0 5 003333333333 00 25
0 03333333333 00 25 00 2
DINV
THE FUNCTIONS INV AND INVP EACH PRODUCE THE INVERSE OF THE
MATRIX ARGUMENT SUPPLIED, EMPLOYING GAUSS-JORDAN (IoEo,
COMPLETE) ELIMINATION INVP EMPLOYS PIVOTING AND INV DOES
0
NOTo
THE FIRST LINE APPENDS THE UNIT VECTOR l~lN AS THE LAST
COLUMN OF THE ARGUMENT AND THE SECOND LINE (LINE 4 IN INVP)
PERFORMS AT EACH ITERATION ONE OF THE N COMPLETE INVERSIONS
REQUIRED SEE EXERCISE 1
0 OF IVERSON, 4 EHQQR4MMI~Q 040
VINV[OJV
V Z+INV M;I;J
[lJ M+Q(l 0 +pM)p(,QM),~J+l<lI+ltpM
[2J M+l~(J,l)~[lJM-(JxM[;lJ)ooxM[l;J+M[l;J+M[l;lJ
[3J +2X10~I+I-l
[4J Z+M[;lltpMJ
VINVP[OJv
V Z+INVP M;I;J;K;P
[lJ M+Q(l 0 +pM)p(,QM),~J+l<P+1I+ltpM
[ 2J M[ K, 1 ; 1 P P J +M [ 1 , K+ ( I M[ 1 I ; 1 J ) 1 r/ I M[ 1 I ; 1 J ; 1 PPJ
[3J P+l~P,OpP[K,lJ+P[l,KJ
[4J M+l~(J,l)~[lJM-(JxM[;lJ)ooxM[l;J+M[l;J+M[l;lJ
[5J +2X10~I+I-l
[ 6J Z +M [ ;~PJ
O+N+INV M+HILB 3
9 36 30
36 192 180
30 180 180
M+ xN
o
B.IO
DPALL
THE FUNCTION PALL PRODUCES THE MATRIX OF ALL PERMUTATIONS OF
ORDER No THE FUNCTION PERM WHICH IT USES PRODUCES THE B-TH
PERMUTATION OF ORDER N BY A METHOD DUE TO LoJoWOODRUM o
OPPOSI'TE ORDER 0
VPALL[OJ\7
\7 Z+-PALL N;I
[1J Z+-«!N),N)pO
[2J 1+-1
[3J Z[I;J+-N PERM I
[4J +3x(!N)~I+-I+1
VPERM[OJ\7
\7 Z+-A PERM B;I; Y
[1J 1+-pZ+-1+(¢lA)TB-1
[2J +OxIO=I+I-1
[3J Z[YJ+-Z[YJ+Z[IJSZ[Y+-I+IA-IJ
[ 4 J -j-2
VPER[OJ\7
\7 P+-PER M;X;Y;Z
[1J +OxIM=P+ 1 1 p1
[2 J Z+-PER M-1
[3J P+-IX+-O
[4J +OxIM<X+X+1
[5J Y+-(~(lM)EX)\Z
[6J Y[;XJ+-M
[ 7J P+- ( (X x ! M-1 ) , M) p ( , P ) , , Y
[8J +4
PALL 3
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1
'TIME
0 3 7
Z+-PALL 3
TIME
0 0 4·9
Z+-PALL 5
'TIME
0 25 10
Z+-PER 5
'TIME
0 1 12
B.ll
DASSOC
\7ASSOC[O J \7
\7 Z+ASSOC M
[1J Z+~/,M[M;J=Ml;MJ
\7
M+(15)<p5 5P15
M
2 3 4 5 1
3 4 5 1 2
4 5 1 2 3
5 1 2 3 4
1 2 3 4 5
TIME
0 0 13
ASSOC M
1
TIME
009
M+O 0 1 0 O<PM
M
2 3 4 5 1
3 4 5 1 2
5 1 2 3 4
5 1 2 3 4
1 2 3 4 5
ASSOC M
0
TIME
0 0 10
M+?10 1 Op 10
pM
10 10
TIME
0 0 3
ASSOC M
0
TIME
0 0 45
B.12
) LOAD 1 NEWS
SAVED 10
044 008 07/12/68
DESCRIBE
B.l3
BIBLIOGRAPHY
1.1
e I-beam functions 3.20 3.46-48
see Exponential Identity element table 3.34
Edit IMPROPER LIBRARY REFERENCE 2.7
in function definition 3.18-19 2.26-27 2.31
A.5 INCORRECT COMMAND 2.6-7
text 2.13 INCORRECT SIGN-ON 1.9 2.7
Element-by-element 3.5 3.9 3.33 Index 3.26 3.38
A.l INDEX ERROR 3.4 3.30 3.34
Empty array 3.29 3.33 Index generator 3.9 3.38 A.2
Empty vector 3.10 3.29 A.2 Indexing 3.26 3.30-33 A.14-l5
Encode 3.38 3.43 B.2 Index of 3.38 3.43
Entries 1.6-7 3.2 3.24 Index origin 2.20 3.32-34 A.8
Epsilon Inner product 3.5 3.33 3.35 A.9
see Characteristic table 3.36
Equal 3.7-9 3.34 Input
Equipment 1.1 1.2 character 3.25
Erase 1.7 2.27 3.3 escape from loop 3.25
ERASE 2.7 2.13 2.20 3.19 A.5 evaluated 3.24
Error 1.7 position 1.8 2.4
Error report 3.3 3.5 Input and output 3.23-26 A.6
during defined function 3.5 Inquiry command 1.8 2.5 2.28
table 3.4 action and notes 2.28-32
Evaluated input 3.24 table 2.7
Evaluation, order of Insert by backspacing 3.3
see Order of execution Interrupt 1.1 2.4 2.9 3.20
Exclusive or 3.9 Iota
Execution mode 2.5 3.19 see Index generator, Index of
Execution, order of Iteration counter 3.13
see Order of execution
Expand 3.29 3.38 3.42 A.13
Exponential 3.7 Key 1.8 2.3 2.14
Exponential form 3.2 4.2-3 A.l Keyboard 1.3
Expression, compound 3.3 3.14 locked 1.6-8 2.32-33
unlocked 1.10 2.4 2.34 3.24
Factorial 3.7 3.9 3.16 A.3 Keying time 3.47
Floor 3.7-8
FNS 2.7 2.28 3.22
Function name 2.19 3.2 3.11 Label 3.17
3.23 LABEL ERROR 3.4
Function definition 3.10-11 LENGTH ERROR 3.4 3.33 4.3
3.17-19 A.4-6 Less 3.7 3.9
Functions LIB 2.7 2.31
see Circular, Defined, Dyadic, Library 2.2
Halted, Library, Locked, Mixed, see Private, Public
Monadic, Pendent, Primitive, LIBRARY 1 4.1
Recursive definition, Scalar, ADVANCEDEX B.1-12
Suspended, System dependent APLCOURSE 4.5
Fuzz 3.8 NEWS B.13
TYPEDRILL 4.8-9
Gamma function 3.9 WSFNS 3.32 4.7
Gauss-Jordan elimination B.10 Library control command 2.5
Global object 2.3 2.15-20 3.23 2.22-24
Global variable 2.13-14 2.29 3.13 action and notes 2.25-27
A.3 table 2.7
Grade up and down 3.38 3.44 Library function 2.5 4.1-9
Graph 4.2 4.5 Library number 2.14 2.23
Greater 3.7 3.9 LIBRARY TABLE FULL 2.9
Greatest common divisor A.4 B.5 Line width 2.21
GROUP 2.7 2.13-14 2.19 2.29 List, construct and use B.3
GRP, GRPS 2.7 2.29-30 3.22 LOAD 2.7 2.22
Local variable 2.3 3.13 3.22
Halted function 2.3 2.22 2.30-31 Lock 2.3 2.10
Header 3.13 3.15-19 A.3 Locked function 3.5 3.9
Hexadecimal number B.8 Locked keyboard 1.6-8 2.4 2.32-33
Homonyms 2.3 3.22-23 Logarithm 3.7
Hyperbolic functions Logical function 3.5 3.9
see Circular functions Logical result A.2
1.2
Magni tude 3. 7-· 8 Parentheses in expression 3.3
Material implication 3.9 Parenthesis, right 1.8 2.5-6
Mathema.tical statements 3.1 Password 1.8 2.3 2.10
Matrix 3.26-27 3.33 3.35 A.7 PCOpy 2.13 2.18
A.15 Pendent function 2.3 2.30 3.21
Hilbert B.lO Permutation 3.32 3.37 A.8 A.14
Maximum 3.7 3.34 A.9 B.11
Membership 2.30 3.38 3.43 A.15 Pi times 3.7
Message 1.8 2.21 2.32-33 Plus 3.7 3.34
MESSAGE LOST 2.7 2.33 Polynomial B.6
Minimum 3.7 3.34 Ports 1.1
Minus 3.2 3.7 3.34 PORTS 2.7 2.32
Mixed functions 3.37-45 Power 3.7 3.34
names 3.5 Precision of numbers 2.21 3.5
s ampl,e A.lO-l5 Primitive functions 3.1 3.7 3.14
table 3.38-39 3.38
Monadic functions 3. 7- 8 names 3.5
Monadic transpose 3.40 see Mixed, Scalar
MSG, MSGN 2.7 2.33-34 Printing element 1.1-3
Private library 2.2-3 2.23
Names 2.2-3 2.14 2.19 2.23 Programming examples B.1-12
3.,10 3.13 Protecting copy command 2.13 2.18
acti VE~ and latent referents 3.22 Public library 2.2 2.23 4.1
3.,23
to obt:ain 1ist:s of 2.28-31
Nand 3.7 3.9 3.34 Quad 3.24-25 3.47
Natural logarithm 3.7 Quotation mark 3.2
Negation function 3.2 Quote quad 3.25 3.47
Negative number 3.2 3.7 A.1
NO SPACE 2.9
Nor 3.7 3.9 3.34 Radices 3.42
Not 3.,7 Random 3.7 3.45 A.15
Not equal 3.7-9 3.33 RANK ERROR 3.4 3.33 4.3
Not greater 3.7 3.9 3.34 Rank of array 3.26-27 A.14
NOT GROUPED, NAME IN USE' 2.7 2.19 Ravel 3.27-28 3.38
Not less 3.7 3.9 3.34 Reciprocal 3.7
NOT SA lIED, THIS WS IS wsid 2.7 Recording terminal 1.4 2.8 2.24
2.,27 2.32 2.34-35
NOT SAVED, WS QUOTA USED UP 2.7 Recursive definition 3.16 B.7
2.,27 B.1l
NOT WITH OPEN DEFINITION 2.7 2.16 Reduction 3.5 3.33-35 A.9
2.,25 3.19 Representation 3.43 A.13
NUMBER IN USE 1.9 2.7 Request button on 1050 terminal 1.8
NUMBER LOCKED OUT 1.9 2.7 RESEND 1. 7 3.4
NUMBER NOT IN SYSTEM 1.9 2.7 Reshape 3.28 3.38 A.7
Number of terminals connected 3.47 Residue 3.7-8 3.34
Numbers 3.2 3.5 3.26 Response 1.9-11 2.6 2.10 A.1
table 2.7
OBJECT NOT FOUND 2.7 2.16 Results 3.2 3.14-15
occur-rence s B.4 Return 1.6-7 3.3
OFF 2.7 2.10-11 Reverse 3.38 3.41 A.12
Operator 1.4-5 1.8 Revise 3.17
OPR, OPRN 1.8 2.7 2.34-35 Rho
Or 3.5 3.7 3.9 3.34 see Reshape, Size
Order of execut:ion 3.45 Roll 3. 7
compound exp re s s i.on 3.3 A.1 Rotate 3.38 3.40 A.12
de f i.ried functi.on 3.11 Row 3.30-32 3.35 3.42 A.7
ORIGIN 1.7 2.7 2.20 3.32 4.7
Out of 3.34
Outer product 3.5 3.33 3.35-36 SAVE 2.7 2.22 2.25-26
Output 2.1 2.21 3.23 3.25 Scalar 3 u27 3.37
array 3.33 Scalar functions 3.5-10
fixed point 4.2 extend to arrays 3.33-36
heterogeneous 3.26 sample A.2
maximum digits 2.21 table 3.7
Overstrike 3.3-4 3.19 3.25 Security 2.3
3 .. 35 3.41 3.45 Semicolon 3.13 3.26
1.3
SI, SIV 2.7 2.30-31 3.20-22 Trace 3.16 3.19 3.21 A.3
Sign on 1.8-10 2.7 Transmission signal 1.6-7
Signum 3.7 A.3 Transpose 3.37-41 A.10-ll
Sine 3.7 A.2 Transposition table 3.40
Sine, cosine, tangent table A.ll Trigonometric functions
Sinh 3.7 see Circular functions
Size 3.5 3.27 3.38 Trouble report 1.7 2.6
Spaces 2.6 3.2 table 2.7
Specification 3.1 Typewriter entry 1.6-7 3.2 3.24
multiple 3.45 A.l
State indicator 2.1 2.22 3.20-21
3.48 A.5
with local variables 3.22 User code 1.11 2.28
Statement 3.1
end of 3.3 Value 3.11 3.14-15 3.17 3.25
invalid 3.3 3.5 A.2 3.45
number 3.10-11 3.17-18 3.48 VALUE ERROR 3.4 3.15
Statistical calculations 2.13 Variables
Stop control 3.19 3.21 local and global 2.3 3.13 3.22
Storage 2.1 2.24 3.46 names 2.1-2 2.19 3.22-23
Store workspace 2.25-26 value 3.1 3.14 3.32
Suspended function 2.30 3.20-21 VARS 2.7 2.29 3.22
3.48 Vectors 3.9-10 3.26-27 3.35 A.l
Symbols 3.5 3.7 3.24-25 3.38 mixed functions apply 3.37
3.45 numerical and character constant
SYMBOL TABLE FULL 3.4 3.2 A.l
SYNTAX ERROR 3.4 scalar functions apply 3.9
System command 2.1 2.5-6
during function definition 3.19 WIDTH 2.7 2.21 3.25 4.7
table 2.7 Work session
System dependent function 2.5 2.30 forced end 2.8
3.46-48 to end 1.10-11 2.10-12
table 3.47 to start 1.8
SYSTEM ERROR 3.4 Workspace 1.9 2.1-2
System information 1.9 3.46-48 activate 2.14-15
active 2.13 2.28
Tabular output 4.3 capacity 2.1
Take 3.38 3.44 clear 1.10 2.6 2.14
Tangent 3.7 A.2 continue 1.10 2.8 2.24
Tanh 3.7 identification 2.14 2.23 2.31
Teaching 2.13 identification change 2.22-23
Telephone nQ~ber 1.5 index origin 3.33
Terminal information transfer between 2.13
table of features and options 1.2 in libraries 4.1
1050 1.1 1.5 1.7-8 name 2.2-3
2740 1.4-6 purge an active 2.24
2740-1 1.1 replace stored with active 2.25
2741 1.1 1.4-6 2.4 stored 2.2-3 2.23
Terminal control command 2.5 2.8-9 Workspace control command 2.5
action and notes 2.9-12 2.13-14
table 2.7 action and notes 2.15-22
Terminal, sample session at A.1-15 WS FULL 2.7 2.16 3.4
Terminal modes 2.5 WSID 2.7 2.31
Time 1.9 1.11 2.9 3.46-48 B.7 WS LOCKED 2.7 2.15
Timer on 1050 terminal 1.8 WS NOT FOUND 2.7 2.15 2.27
Times 3.7 3.33
Time, student response 3.47 Zero of a function B.9
1,,4