Appendix: Quick Reference


List of Primitive Functions and Operators, with References

The symbols are ordered here by type of function (arithmetic, structuring, etc.) and are followed by the dyadic and monadic names:

SymbolDyadic FunctionMonadic Function
+AddIdentity
-SubtractNegate
MultiplySign
DivideReciprocal
*PowerExponential
LogNatural log
|ResidueAbsolute value
DecodePack
EncodeUnpack
?DealRoll
Circle (sin, cos, ...)Pi times
SolveMatrix Inverse
MaxCeiling
MinFloor
<Less thanEnclose
Less than or Equal to(no monadic)
=Equal to(no monadic)
>Greater thanDisclose
Greater than or Equal to(no monadic)
Not equal to(no monadic)
BinsGrade up
(no dyadic)Grade down
MatchDepth
FindInterval
MemberRake
^AndStop
Or or CastType
FormatDefault Format
Execute in Context
or Protected Execute
Execute
%Value in ContextValue
Map (see "Files in A+")Map In (see "Files in A+")
Assignment
or Selective Assignment
Result
PickRaze
#ChooseCount
[;]Bracket Indexing (varying number of arguments)
TakeSignal
DropPrint
RotateReverse
Transpose AxesTranspose
!RestructureItem Ravel
PartitionPartition Count
ReshapeShape
LeftNull
(no dyadic)Right
Combine SymbolsSeparate Symbols
,CatenateRavel
~LaminateNot
/ReplicateReduce (+ ^ )
\ExpandScan (+ ^ )
. Inner Product
(+.   .+   .+)
(no monadic)
.Outer Product
(+ - | < = > )
(no monadic)
@Rank(no monadic)
(no dyadic)Each or Apply
(no dyadic)Bitwise


Lists of System Functions, Variables, and Commands, with References

System Function Names and References
_alldepAll Dependent Object Names
_alsfAssociation List to Slotfiller
_attsAll Attributes
_cdChange Directory
_cfiComma Fix Input
_dbgDebug
_defDependency Definition
_depDependent Object Names
_dyldDynamic Load
_exExpunge
_excxtExpunge Context
_exitExit
_fiFix Input
_flatFlatten
_fmtFormat
_gcbGet Callback
_gcdGet Client Data
_getGet Attribute
_gfmtsymGet Format Symbols
_gpcbGet Preset Callback
_gsrGeneral Search and Replace
_gsvGet System Variable
_hashstatHash Table Statistics
_indexPermissive Indexing
_index_ofIndex of
_issfIs a Slotfiller
_itemsItems of a Mapped File
_loadLoad
_loadrmLoad and Remove
_localsLocals
_nameName
_nanfindNaN Find
_ncName Class
_nlName List
_nsName Search
_nsrName Search and Replace
_scbSet Callback
_scdSet Client Data
_scfiScalar Comma Fix Input
_setSet Attribute
_sfiScalar Fix Input
_sfmtScreen Format
_spcbSet Preset Callback
_ssString Search
_ssrString Search and Replace
_ssvSet System Variable
_undefRemove Dependency Definition
_valenceValence
_waWork Area

System Variable Names and References
`busexitBus Error Flag
`corelimCore File Size Limit
`cxContext
`DfDependency Flag
`dymeDynamic Environment
`EfExecution Suspension Flag
`GfProtected Execute Flag
`languageLanguage Level
`loadfileFile Being Loaded
`majorReleaseMajor Release Number
`minorReleaseMinor Release Number
`modeInput Mode
`phaseOfReleasePhase of the Release
`ppPrinting Precision
`releaseCodeRelease Code
`rlRandom Link
`segvexitSegv Error Flag
`SfCallback Flag
`siK Stack
`stdinStandard Input
`stopStop
`TfTerminal Flag
`versVersion
`XfX Events Flag

System Command Names and References
$| Pipe
$< Pipe In
$> Pipe Out
$>> Pipe Out Append
$cdChange Directory
$cmdsCommands
$cxContext
$cxsContexts
$dbgDebugging State
$defDependency Definition
$depDependent Object Names
$depsDependencies
$DfDependency Flag
$EfExecution Suspension Flag
$exExpunge
$excxtExpunge Context
$fnsFunctions
$GfProtected Execute Flag
$globsGlobal Objects
$loadLoad
$loadrmLoad and Remove
$modeInput Mode
$offOff
$opsOperators
$ppPrinting Precision
$resetReset
$rlRandom Link
$SfCallback Flag
$sfsSystem Functions
$siState Indicator
$stopStop
$TfTerminal Flag
$undefRemove Dependency Definition
$varsVariables
$versVersion
$waWorkspace Available
$XfX Events Flag
$xfsExternal Functions


Two Tables of Examples of Operators

Examples of Operators
ExpressionDescriptionExample
fn@nRank: fn applied to all rank-n subarrays @1 vect +@1 mat
fn Each: for each scalar s: < fn >s i + ɡ n
fdApply enclosed function fd f(+;-); x f[0] y

Examples of Operators
OperatorExpressionRemarks
Rank,@0 v?49Ravel applied to scalars
Rankv ,@0 m?3 49 Catenate applied scalar by scalar
Rankm +@1 0  v?39 vector-scalar (also m +@1 v)
Rankm +.@1 1 0 m vector-vector (all other axes are all versus all)
Inner Productx f.g y: f/x(g@0 1 1)y
Outer Product x .g y: x (g@0 0 0) y


Data Types

Table of Data Types
Data TypeA+ SymbolExamples
character`char 'per cent' and '' and "net"
integer`int 0 and 4 14 59 86 and 0
floating point (IEEE double precision)`float 3.26 1e5 3.1e-2 and 0 02.
box (enclosed object) and nested array with first item of type box`box (3 4;5) and (`ns;1;+) and <7.
empty array other than character, integer, and floating point, including the Null `null () and 0 0 (2;3 4;5) and 0`a`b and 0(+;-;;;`s)
symbol, and nested array with first item simple symbol`sym `pp and `rl `stop and `ns,(1;+)
function expression, function scalar, and nested array with first item function scalar`func + and <{+} and (+;-;;) and (<{+}),`sand (;2 3;'a')


Examples of Primitive and Defined Functions

Examples of Primitive Functions
SymDescriptionMonadic ExampleDyadic Example
#Tally and Choose #8 and #2 3 1#8 and 1#2 3
Partition Count and Partition 1 0 1 0 02 35
Raze and Pick(2 3; 4 5 6) 1(2 3; 4 5 6)
!Item Ravel and Restructure!2 3 2!8 and 2!8
~Not and Laminate ~1 0 14~9
Type and Cast `ibm`char256
Pack and Decode 'ibm'24 60 602 5 59
Unpack and Encode `ibm24 60 607559
Map In and Map `f`f  9 and 1`f (open-write)
Grade Up and Bins?1000100 1 0 1  .3 1 5

Example of a Defined Function:
Signal () Display () Stop&Trace (^) Return () and Line Numbers
Function Definition Function Line Indicator
$si
Meaning
n foo t:{
 
  if(n)  `rank;
 
 
 
  if (~n)  `stop;
 
  if (n<0)  n;
 
  (mn) do{
 
 
 
    ^m;
 
    tt,t[m]};
 
  t}
 
 
foo[1]
 
 
 
foo[2]
 
foo[3]
 
foo[4]
 
 
 
foo[4 do 1]
 
foo[4 do 2]
 
foo[5]
 
 
signal rank error 
(for if and while, 
only zero is false) 
 
signal stop 
 
display and return n
 
repeat n times
(m runs from
0 through n-1)
 
stop, or trace m
 
use m as index
 
return t (last expression)


Errors
and Stops

When there is an error the function and error type is shown. For example,
+: length
or
.foo: rank
This is preceded by
[error]
When there is a stop the function and message are shown; names are shown fully qualified. At this point you can take one of the actions shown in the following
table.

Error and Stop Actions
User ActionA+ Expression
reset (abort)$ or
show state$si
signal up an error`length
return x x
resume execution,
with an enlarged workspace
when the error was wsfull
inspect the stack&0 (for entry 0)
change entries on the stack &1  2 3 4 (entry 1)

A leading * is displayed for every level of resetting required to get clear. The state indicator shows a line for every function call.

The & symbol by itself represents self-reference; for example:

   fact n: if (n>0) n & n-1 else 1

is the standard recursive factorial definition.


Files

File Names
Form of NameUseExample
*.   or
*.+  or
*.a
function and data definitionsutil.+
*.mmappable simple arraysprice.m

Printing Files
CommandMeaningFile Type
$| var lpr Pipe the file named var to lpr command. reports or variables

Getting Around
 
Command Meaning Example
$cd change Unix directory $cd /u/a
$cx change A+ context $cx stat
Name Use
All files (.a .+ .m .c etc.) are in the Unix hierarchical file system, and can always be referred to by their full pathnames.
All A+ global variables are in either the root context or other contexts, and can be referred to by context.name .


System and Unix Command Syntax and Meaning

Examples of System Command Syntax and Meaning
CommandMeaning
$cd [d] current [change to d] directory
$load fns load fns. or fns.+ or fns.a
$cx [x]current [change to x] context
$vars [x] list variables (in current [or x] context)
$fns [x] list functions (in current [or x] context)
$ops [x] list operators (in current [or x] context)
$xfs [x] list external functions (in current [or x] context)
$ex name[s] expunge name[s] in current context
$cxslist all contexts
$sfslist system functions
$wa [m] workspace available [add m megabytes].
(When a wsfull error is encountered, alone on a line causes execution to be resumed with an enlarged workspace.)
$pp [n] current [change to n] printing precision
$rl nset random link
$sistate indicator stack
$stop [0 | 1 | 2] stops [off or on or trace]
$cmdslist the commands
$offsign off

Examples of Unix Command Syntax and Meaning
CommandMeaning
$ls *.alist all .a files
$rm t.mremove t.m
$mv f gmove f to g
$cp f gcopy f to g
$df /s/atmpdisk free for workspace
$mkdir dmake a new directory d
$rmdir dremove directory d
$datedisplay the date
Any non-A+ system commandremove $ and pass to Unix


Atomic Vector and Graphic Characters

Graphic Characters for Atomic Vector
(`char16 16) (HEX row and column labels)
  
0123 4567 89AB CDEF
  
00
10
20
30
40
50
60
70
80
90
A0
B0
C0
D0
E0
F0
                
                
 !"#$%&'()*+,-./
0123456789:;<=>?
@ABCDEFGHIJKLMNO
PQRSTUVWXYZ[\]^_
`abcdefghijklmno
pqrstuvwxyz{|}~?
                
                
     
     
   |
    
    
        
0F
1F
2F
3F
4F
5F
6F
7F
8F
9F
AF
BF
CF
DF
EF
FF
  
0123 4567 89AB CDEF
  


System Limits

Parse-Time System Limits
EntityLimit
locals999
items in a list notation999
items in a vector notation9999
nested parentheses depth999
input strings9999
number of function arguments 9
number of dyld'd function arguments8

Run-Time System Limits
EntityLimit
addressability4 billion bytes
array rank9
array dimensions2 billion
array depth approximately 87,0001
symbol length2 billion
simultaneously mapped files (else a maplim error occurs) 2,000 default, but can be increased or decreased by $maplim and `maplim.
open file descriptors Depends on system; for Solaris, the default soft limit (as shown by ulimit -a) is 256 and the hard limit (ulimit -Ha) is 1024. The limit includes adap connections, but not mapped files, which are closed after they are mapped.
A+ recursive stack2,000
, recursive stack10,000
integerroughly -2 billion to 2 billion (32 bits)
float16 decimal digits of precision (IEEE 64 bit); results beyond the 16th digit are not valid

  1. Depends on the depth of the C stack, and so on the machine architecture.  [Back to table cell]


A+ Keyboard

Click here to go to the interactive keyboard layout.



Click here for a keyboard diagram which will print much more clearly on a black-and-white laser printer.

doc@aplusdev.org© Copyright 1995–2008 Morgan Stanley Dean Witter & Co. All rights reserved.