Quad name
|
A quad name or system name is a general term for built-ins denoted by a name beginning with the quad character, <syntaxhighlight lang=apl inline>⎕</source>. The term only used when explicitly needing to cover all syntactic classes of such built-ins; constants, variables, objects, functions and operators. It is common to call these system constants, system variables, etc., although the term system function is often used as a synonym for quad name. Quad names are used for features that abide by the normal syntax, but are not part of the core language. <syntaxhighlight lang=apl inline>⎕</source> by itself (standard output/evaluated input) and <syntaxhighlight lang=apl inline>⍞</source> (message output/standard input) are often included in the quad name category.
Support
Dialects vary widely in their repertoire of quad names, but generally agree on their naming, so if two dialects share a quad name, it is likely that the meaning of it is identical or very similar. As opposed to other alphabetical identifiers, system names are case insensitive (except <syntaxhighlight lang=apl inline>⎕a</source> in APLX), though most traditionally uppercase them. One of the most commonly system variables is <syntaxhighlight lang=apl inline>⎕IO</source> (Index origin).
Classes
Quad names can have any of the existing syntactic classes:
- System constants are handy values like the alphabet (<syntaxhighlight lang=apl inline>⎕A</source>), but can also be used to query various global states, like the current time stamp (<syntaxhighlight lang=apl inline>⎕TS</source>). Of course, the time will vary, so it isn't constant in that sense, however, but they are constant in that they cannot be altered by assignment.
- System variables are used to alter the behaviour of the language. For example the number of significant digits displayed can be controlled by setting the print precision (<syntaxhighlight lang=apl inline>⎕PP</source>).
- System objects are references to namespaces, in particular the session object (<syntaxhighlight lang=apl inline>⎕SE</source>).
- System functions are various utility functions, like <syntaxhighlight lang=apl inline>⎕FX</source> to define ("FiX") a function under program control.
- System operators only occur in Dyalog APL and are used for things like text search and replace (<syntaxhighlight lang=apl inline>⎕S</source> and <syntaxhighlight lang=apl inline>⎕R</source>).
Like primitives, quad names exhibit behaviour as if there's one copy in each namespace, and so for some of them, their value can vary depending on the namespace in which they are used.
Unusual behaviour
Some system variables exhibit behaviour that is unusual for other items of their class. for example:
- While <syntaxhighlight lang=apl inline>⎕</source> and <syntaxhighlight lang=apl inline>⍞</source> syntactically act like variables, they have the side effect of printing whatever is assigned to them, to stdout and stderr respectively.
- <syntaxhighlight lang=apl inline>⎕OFF</source> and <syntaxhighlight lang=apl inline>⎕CLEAR</source> behave syntactically as constants, although when querying their value, the interpreter will shut down or clear the workspace, respectively.
- Variant, <syntaxhighlight lang=apl inline>⎕OPT</source> (which is a synonym of the primitive operator <syntaxhighlight lang=apl inline>⍠</source>), is syntactically a normal operator, but it amends a current state of settings for its operand, which may itself have an associated state though its usage.
- The base class object, <syntaxhighlight lang=apl inline>⎕BASE</source>, cannot be used by itself, only with a namespace dot after it, to access the inside of the current object's base class. Therefore, one must use the current namespace system object, inside the base object to get a reference to the base class; <syntaxhighlight lang=apl inline>⎕BASE.⎕THIS</source>.
External links
Lessons
- APL Cultivation: behaviour, session
- APL Cultivation: constants, tools & external utils
- APL Cultivation: code management, I/O, dates, Unicode files, errors
- APL Cultivation: stack & workspace info, misc
Documentation
APL features [edit] | |
---|---|
Built-ins | Primitives (functions, operators) ∙ Quad name |
Array model | Shape ∙ Rank ∙ Depth ∙ Bound ∙ Index (Indexing) ∙ Axis ∙ Ravel ∙ Ravel order ∙ Element ∙ Scalar ∙ Vector ∙ Matrix ∙ Simple scalar ∙ Simple array ∙ Nested array ∙ Cell ∙ Major cell ∙ Subarray ∙ Empty array ∙ Prototype |
Data types | Number (Boolean, Complex number) ∙ Character (String) ∙ Box ∙ Namespace ∙ Function array |
Concepts and paradigms | Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity element ∙ Complex floor ∙ Array ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ Glyph ∙ Leading axis theory ∙ Major cell search ∙ First-class function |
Errors | LIMIT ERROR ∙ RANK ERROR ∙ SYNTAX ERROR ∙ DOMAIN ERROR ∙ LENGTH ERROR ∙ INDEX ERROR ∙ VALUE ERROR ∙ EVOLUTION ERROR |