Reference
Reference
|
Note: these pages use the APL2741 or APLSans font, both available from Causeway.
R2 Reference
This is a list of all the tokens R2 recognises, and what arguments they can take. The following abbreviations for data types are used:
| i: Integer | n: Number | c: Character | s: String |
| v: Vector (eg nv=vector of numbers) | a: Array (ia=array of integers only) | null: Null | {data}: data is shy. |
Primitives
| Symbol | Niladic | Monadic | Dyadic |
+ | n/a | a„+ a Makes everything on the stack non-shy. | na„na + na Add |
- | n/a | na„- na Negate | na„na - na Subtract |
÷ | n/a | na„÷ na Reciprocal | na„na ÷ na Divide |
× | n/a | ia„× na Sign (1/0/-1) | na„na × na Multiply |
* | n/a | na„* na Exponenitate | na„na * na Power |
— | n/a | ia„— na Ceiling | na„na — na Max |
˜ | n/a | ia„˜ na Floor | na„na ˜ na Min |
^ | n/a | n/a | ia„ia ^ ia Bitwise And |
Ÿ | n/a | n/a | ia„ia Ÿ ia Bitwise Or |
Š | n/a | n/a | ia„ia Š ia Bitwise Nand (Not-And) |
‹ | n/a | n/a | ia„ia ‹ ia Bitwise Nor (Not-Or) |
„ | n/a | {a}„ „ {a} Sink (makes everything on the stack shy) | a„Identifier „ a Assign |
… | n/a | …i/Label Goto | a„a … ia Get items by index |
¼ | n/a | iv„¼ i The integers 1..n | a„a ¼ a Index of one array in another |
½ | n/a | iv„½ a Shape | a„iv ½ a Reshape |
/ | n/a | a„Token/ a Inserts the token between each pair of elements; e.g. +/[1 2 3] is 6. | a„iv / a Compress |
« | Null | Null | Null |
System Functions
| Function | Niladic | Monadic | Dyadic |
ŒDEPTH | i„ŒDEPTH The depth of the function stack | n/a | n/a |
ŒED | n/a | ŒED c/cv/s Edits a function or variable | n/a |
ŒEX | n/a | ŒEX c/cv/s Deletes a function or variable | n/a |
ŒOFF | i„ŒOFF Exits R2. If it returns, the value is 0. | n/a | n/a |
System Variables
| Variable | Read-Only | Type | Meaning |
ŒA | Yes | cv | The uppercase alphabet |
ŒALOW | Yes | cv | The lowercase alphabet |
ŒABOTH | Yes | cv | The uppercase alphabet, followed by the lowercase alphabet |
ŒAV | Yes | cv | The complete character set |
ŒD | Yes | cv | The digits |
ŒGLOBALS | Yes | cv | The characters which when used as the first letter of a name define that name to be global. This is set to ‘Œ |
ŒIO | Yes | i | Index origin; fixed to 1 |
ŒSHOWH
| |