A+ Reference: Appendix: Quick Reference

# Appendix: Quick Reference

Table of Primitive Functions and Operators, with References
Tables of System Functions, Variables, and Commands, with References

Table: System Function Names and References
Table: System Variable Names and References
Table: System Command Names and References

Examples of Operators

Table: Examples of Operators
Table: Examples of Operators

Data Types

Table: Data Types

Examples of Primitive and Defined Functions

Table: Examples of Primitive Functions
Table: Example of a Defined Function

Errors and Stops

Table: Error and Stop Actions

Files

Table: File Names
Table: Printing Files
Table: Getting Around

System and Unix Command Syntax and Meaning

Table: Examples of System Command Syntax and Meaning
Table: Examples of Unix Command Syntax and Meaning

Atomic Vector and Graphic Characters

Table: Graphic Characters for Atomic Vector

System Limits

Table: Parse-Time System Limits
Table: Run-Time System Limits

Layout of the A+ Keyboard

## 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:

> Symbol | Dyadic Function | Monadic Function
> --- | --- | ---
> + | Add | Identity
> - | Subtract | Negate
> « | Multiply | Sign
> ß | Divide | Reciprocal
> * | Power | Exponential
> ð | Log | Natural log
> | | Residue | Absolute value
> Â | Decode | Pack
> Î | Encode | Unpack
> ? | Deal | Roll
> Ï | Circle (sin, cos, ...) | Pi times
> | Solve | Matrix Inverse
> Ó | Max | Ceiling
> Ä | Min | Floor
> < | Less than | Enclose
> ¤ | Less than or Equal to | (no monadic)
> = | Equal to | (no monadic)
> > | Greater than | Disclose
> ¦ | Greater than or Equal to | (no monadic)
> ¨ | Not equal to | (no monadic)
> è | Bins | Grade up
> ç | (no dyadic) | Grade down
> ½ | Match | Depth
> É | Find | Interval
> Å | Member | Rake
> ^ | And | Stop
> © | Or or Cast | Type
> î | Format | Default Format
> â | Execute in Context or Protected Execute | Execute
> % | Value in Context | Value
> à | Map (see "Files in A+") | Map In (see "Files in A+")
> û | Assignment or Selective Assignment | Result
> Ø | Pick | Raze
> # | Choose | Count
> [;] | Bracket Indexing (varying number of arguments)
> Ù | Take | Signal
> Õ | Drop | Print
> ÷ | Rotate | Reverse
> ô | Transpose Axes | Transpose
> ! | Restructure | Item Ravel
> Ú | Partition | Partition Count
> Ò | Reshape | Shape
> Ý | Left | Null
> Û | (no dyadic) | Right
> Ö | Combine Symbols | Separate Symbols
> , | Catenate | Ravel
> ~ | Laminate | Not
> / | Replicate | Reduce (+ « Ó Ä ^ ©)
> \ | Expand | Scan (+ « Ó Ä ^ ©)
> . | 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
> _alldep | All Dependent Object Names
> _alsf | Association List to Slotfiller
> _atts | All Attributes
> _cd | Change Directory
> _cfi | Comma Fix Input
> _dbg | Debug
> _def | Dependency Definition
> _dep | Dependent Object Names
> _dyld | Dynamic Load
> _ex | Expunge
> _excxt | Expunge Context
> _exit | Exit
> _fi | Fix Input
> _flat | Flatten
> _fmt | Format
> _gcb | Get Callback
> _gcd | Get Client Data
> _get | Get Attribute
> _gfmtsym | Get Format Symbols
> _gpcb | Get Preset Callback
> _gsr | General Search and Replace
> _gsv | Get System Variable
> _hashstat | Hash Table Statistics
> _index | Permissive Indexing
> _index_of | Index of
> _issf | Is a Slotfiller
> _items | Items of a Mapped File
> _load | Load
> _loadrm | Load and Remove
> _locals | Locals
> _name | Name
> _nanfind | NaN Find
> _nc | Name Class
> _nl | Name List
> _ns | Name Search
> _nsr | Name Search and Replace
> _scb | Set Callback
> _scd | Set Client Data
> _scfi | Scalar Comma Fix Input
> _set | Set Attribute
> _sfi | Scalar Fix Input
> _sfmt | Screen Format
> _spcb | Set Preset Callback
> _ss | String Search
> _ssr | String Search and Replace
> _ssv | Set System Variable
> _undef | Remove Dependency Definition
> _valence | Valence
> _wa | Work Area

> System Variable Names and References
> `busexit | Bus Error Flag
> `corelim | Core File Size Limit
> `cx | Context
> `Df | Dependency Flag
> `dyme | Dynamic Environment
> `Ef | Execution Suspension Flag
> `Gf | Protected Execute Flag
> `language | Language Level
> `loadfile | File Being Loaded
> `majorRelease | Major Release Number
> `minorRelease | Minor Release Number
> `mode | Input Mode
> `phaseOfRelease | Phase of the Release
> `pp | Printing Precision
> `releaseCode | Release Code
> `rl | Random Link
> `segvexit | Segv Error Flag
> `Sf | Callback Flag
> `si | K Stack
> `stdin | Standard Input
> `stop | Stop
> `Tf | Terminal Flag
> `vers | Version
> `Xf | X Events Flag

> System Command Names and References
> $| | Pipe
> $< | Pipe In
> $> | Pipe Out
> $>> | Pipe Out Append
> $cd | Change Directory
> $cmds | Commands
> $cx | Context
> $cxs | Contexts
> $dbg | Debugging State
> $def | Dependency Definition
> $dep | Dependent Object Names
> $deps | Dependencies
> $Df | Dependency Flag
> $Ef | Execution Suspension Flag
> $ex | Expunge
> $excxt | Expunge Context
> $fns | Functions
> $Gf | Protected Execute Flag
> $globs | Global Objects
> $load | Load
> $loadrm | Load and Remove
> $mode | Input Mode
> $off | Off
> $ops | Operators
> $pp | Printing Precision
> $reset | Reset
> $rl | Random Link
> $Sf | Callback Flag
> $sfs | System Functions
> $si | State Indicator
> $stop | Stop
> $Tf | Terminal Flag
> $undef | Remove Dependency Definition
> $vars | Variables
> $vers | Version
> $wa | Workspace Available
> $Xf | X Events Flag
> $xfs | External Functions

##
Two Tables of Examples of Operators

> Examples of Operators
> Expression | Description | Example
> --- | --- | ---
> fn@n | Rank: fn applied to all rank-n subarrays | è@1 vect +@1 mat
> fn¡ | Each: for each scalar s: < fn >s | i +¡ É¡ n
> fd¡ | Apply enclosed function fd | fû(+;-); x f[0]¡ y

> Examples of Operators
> Operator | Expression | Remarks
> --- | --- | ---
> Rank | ,@0 vû?4Ò9 | Ravel applied to scalars
> Rank | v ,@0 mû?3 4Ò9 | Catenate applied scalar by scalar
> Rank | m +@1 0 vû?3Ò9 | vector-scalar (also m +@¢1 v)
> Rank | m +.«@1 1 0 m | vector-vector (all other axes are all versus all)
> Inner Product | x 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 Type | A+ Symbol | Examples
> --- | --- | ---
> 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 0Ò2.
> 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
> Sym | Description | Monadic Example | Dyadic Example
> --- | --- | --- | ---
> # | Tally and Choose | #É8 and #É2 3 | 1#É8 and 1#É2 3
> Ú | Partition Count and Partition | Ú1 0 1 0 0 | 2 3ÚÉ5
> Ø | 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 1 | 4~É9
> © | Type and Cast | ©`ibm | `char©É256
> Â | Pack and Decode | Â'ibm' | 24 60 60Â2 5 59
> Î | Unpack and Encode | Î`ibm | 24 60 60Î7559
> à | Map In and Map | à`f | `f à É9 and 1à`f (open-write)
> è | Grade Up and Bins | è?1000Ò100 | ¢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;
> (mûn) do{
> ^m;
> tût,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 Action | A+ 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 Name | Use | Example
> --- | --- | ---
> *. or *.+ or *.a | function and data definitions | util.+
> *.m | mappable simple arrays | price.m

> Printing Files
> Command | Meaning | File 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
> Command | Meaning
> --- | ---
> $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
> $cxs | list all contexts
> $sfs | list 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 n | set random link
> $si | state indicator stack
> $stop [0 | 1 | 2] | stops [off or on or trace]
> $cmds | list the commands
> $off | sign off

> Examples of Unix Command Syntax and Meaning
> Command | Meaning
> --- | ---
> $ls *.a | list all .a files
> $rm t.m | remove t.m
> $mv f g | move f to g
> $cp f g | copy f to g
> $df /s/atmp | disk free for workspace
> $mkdir d | make a new directory d
> $rmdir d | remove directory d
> $date | display the date
> Any non-A+ system command | remove $ and pass to Unix

##
Atomic Vector and Graphic Characters

> Graphic Characters for Atomic Vector
> (`char©É16 16) (HEX row and column labels)
> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F
> 00
> 10
> 20
> 30
> 40
> 50
> 60
> 70
> 80
> 90
> A0
> B0
> C0
> D0
> E0
> F0
> | ! | " | # | $ | % | & | ' | ( | ) | * | + | , | - | . | /
> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | : | ; | < | = | > | ?
> @ | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O
> P | Q | R | S | T | U | V | W | X | Y | Z | [ | \ | ] | ^ | _
> ` | a | b | c | d | e | f | g | h | i | j | k | l | m | n | o
> p | q | r | s | t | u | v | w | x | y | z | { | | | } | ~ | ?
> | ¡ | ¢ |  | ¤ |  | ¦ |  | ¨ | © |  | « | ¬ |  | ® | ¯
> ° | ± |  | ³ | ´ |  | ¶ |  |  | ¹ |  | » | ¼ | ½ | ¾ | ¿
> | Á | Â | Ã | Ä | Å |  | Ç | È | É | Ê |  | Ì | | | Î | Ï
> |  | Ò | Ó |  | Õ | Ö | × | Ø | Ù | Ú | Û | Ü | Ý |  | ß
> à | á | â | ã |  | å | æ | ç | è | é | ê |  | ì |  | î | ï
> ð |  |  |  | ô |  |  | ÷ |  |  | ú | û | ü | ý | þ |
> 0F
> 1F
> 2F
> 3F
> 4F
> 5F
> 6F
> 7F
> 8F
> 9F
> AF
> BF
> CF
> DF
> EF
> FF
> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F

##
System Limits

> Parse-Time System Limits
> Entity | Limit
> --- | ---
> locals | 999
> items in a list notation | 999
> items in a vector notation | 9999
> nested parentheses depth | 999
> input strings | 9999
> number of function arguments | 9
> number of dyld'd function arguments | 8

> Run-Time System Limits
> Entity | Limit
> --- | ---
> addressability | 4 billion bytes
> array rank | 9
> array dimensions | 2 billion
> array depth | approximately 87,0001
> symbol length | 2 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 stack | 2,000
> ç, è recursive stack | 10,000
> integer | roughly -2 billion to 2 billion (32 bits)
> float | 16 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.