Quad name: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Remove duplicated last sentence of the quote)
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
{| class=wikitable style="width:50%;float:right"
{| class=wikitable style="width:50%;float:right"
|{{quote | "The quad <source lang=apl inline>⎕</source> can be used to define the geometries of the other APL characters, since all the APL characters can be described by their relationship to it. The quad character was originally chosen for the font so that it could be used around any of the other characters. In particular, it was chosen to be a size such that it fit around any of the alphabetic characters. For example, the top of the bottom line of the quad is the base line of the alphabetic and numeric characters, and the bottom of the top of the quad is their top. The geometric center of the quad is the center of many of the APL special symbols. In particular, function symbols are normally raised above the baseline of characters — this position is known as the "function center." It is interesting to note that the dimensions of the quad are the "golden section" which is a well-accepted esthetic criterion in art and design."|Joey K. Tuttle. ''APL pi — designing an APL type font'', 1981.}}
|{{quote | "The quad <syntaxhighlight lang=apl inline>⎕</syntaxhighlight> can be used to define the geometries of the other APL characters, since all the APL characters can be described by their relationship to it. The quad character was originally chosen for the font so that it could be used around any of the other characters. In particular, it was chosen to be a size such that it fit around any of the alphabetic characters. For example, the top of the bottom line of the quad is the base line of the alphabetic and numeric characters, and the bottom of the top of the quad is their top. The geometric center of the quad is the center of many of the APL special symbols. In particular, function symbols are normally raised above the baseline of characters — this position is known as the "function center." It is interesting to note that the dimensions of the quad are the "golden section" which is a well-accepted esthetic criterion in art and design."|Joey K. Tuttle. ''APL pi — designing an APL type font'', 1981.}}
|}
|}


A '''quad name''' or ''system name'' is a general term for built-ins denoted by a name beginning with the quad character, <source 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. <source lang=apl inline>⎕</source> by itself (standard output/evaluated input) and <source lang=apl inline>⍞</source> (message output/standard input) are often included in the quad name category.
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>⎕</syntaxhighlight>. 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>⎕</syntaxhighlight> by itself (standard output/evaluated input) and <syntaxhighlight lang=apl inline>⍞</syntaxhighlight> (message output/standard input) are often included in the quad name category.


==Support==
==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 <source lang=apl inline>⎕a</source> in [[APLX]]), though most traditionally uppercase them. One of the most commonly system variables is <source lang=apl inline>⎕IO</source> ([[Index origin]]).
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</syntaxhighlight> in [[APLX]]), though most traditionally uppercase them. One of the most commonly system variables is <syntaxhighlight lang=apl inline>⎕IO</syntaxhighlight> ([[Index origin]]).


==Classes==
==Classes==
Quad names can have any of the existing syntactic classes:
Quad names can have any of the existing syntactic classes:
* System constants are handy values like the [[alphabet]] (<source lang=apl inline>⎕A</source>), but can also be used to query various global states, like the current [[time stamp]] (<source 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 constants are handy values like the [[alphabet]] (<syntaxhighlight lang=apl inline>⎕A</syntaxhighlight>), but can also be used to query various global states, like the current [[time stamp]] (<syntaxhighlight lang=apl inline>⎕TS</syntaxhighlight>). 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]] (<source lang=apl inline>⎕PP</source>).
* 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</syntaxhighlight>).
* System objects are references to namespaces, in particular the session object (<source lang=apl inline>⎕SE</source>).
* System objects are references to namespaces, in particular the session object (<syntaxhighlight lang=apl inline>⎕SE</syntaxhighlight>).
* System functions are various utility functions, like `⎕FX` to define ("FiX") a function under program control.
* System functions are various utility functions, like <syntaxhighlight lang=apl inline>⎕FX</syntaxhighlight> 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 (<source lang=apl inline>⎕S</source> and <source lang=apl inline>⎕R</source>).
* System operators only occur in [[Dyalog APL]] and are used for things like text search and replace (<syntaxhighlight lang=apl inline>⎕S</syntaxhighlight> and <syntaxhighlight lang=apl inline>⎕R</syntaxhighlight>).


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.
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.
Line 21: Line 21:
Some system variables exhibit behaviour that is unusual for other items of their class. for example:
Some system variables exhibit behaviour that is unusual for other items of their class. for example:


* While <source lang=apl inline>⎕</source> and <source lang=apl inline>⍞</source> syntactically act like variables, they have the side effect of printing whatever is assigned to them, to [[wikipedia:stdout|stdout]] and [[wikipedia:stderr|stderr]] respectively.
* While <syntaxhighlight lang=apl inline>⎕</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍞</syntaxhighlight> syntactically act like variables, they have the side effect of printing whatever is assigned to them, to [[wikipedia:stdout|stdout]] and [[wikipedia:stderr|stderr]] respectively.
* <source lang=apl inline>⎕OFF</source> and <source lang=apl inline>⎕CLEAR</source> behave syntactically as constants, although when querying their value, the interpreter will shut down or clear the workspace, respectively.
* <syntaxhighlight lang=apl inline>⎕OFF</syntaxhighlight> and <syntaxhighlight lang=apl inline>⎕CLEAR</syntaxhighlight> behave syntactically as constants, although when querying their value, the interpreter will shut down or clear the workspace, respectively.
* Variant, <source lang=apl inline>⎕OPT</source> (which is a synonym of the [[primitive operator]] <source 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.
* Variant, <syntaxhighlight lang=apl inline>⎕OPT</syntaxhighlight> (which is a synonym of the [[primitive operator]] <syntaxhighlight lang=apl inline>⍠</syntaxhighlight>), 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, <source 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; <source lang=apl inline>⎕BASE.⎕THIS</source>.
* The base class object, <syntaxhighlight lang=apl inline>⎕BASE</syntaxhighlight>, 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</syntaxhighlight>.
== External links ==
== External links ==
=== Lessons ===
=== Lessons ===
Line 33: Line 33:


=== Documentation ===
=== Documentation ===
* [http://help.dyalog.com/latest/#Language/System%20Functions/Summary%20Tables/Introduction.htm Dyalog]
* [https://help.dyalog.com/latest/#Language/System%20Functions/Summary%20Tables/Introduction.htm Dyalog]
* [http://microapl.com/apl_help/ch_020_070.htm APLX]
* [http://microapl.com/apl_help/ch_020_070.htm APLX]
{{APL features}}[[Category:APL syntax]]
{{APL features}}{{APL built-ins}}[[Category:APL syntax]]

Latest revision as of 22:24, 10 September 2022

"The quad can be used to define the geometries of the other APL characters, since all the APL characters can be described by their relationship to it. The quad character was originally chosen for the font so that it could be used around any of the other characters. In particular, it was chosen to be a size such that it fit around any of the alphabetic characters. For example, the top of the bottom line of the quad is the base line of the alphabetic and numeric characters, and the bottom of the top of the quad is their top. The geometric center of the quad is the center of many of the APL special symbols. In particular, function symbols are normally raised above the baseline of characters — this position is known as the "function center." It is interesting to note that the dimensions of the quad are the "golden section" which is a well-accepted esthetic criterion in art and design."

Joey K. Tuttle. APL pi — designing an APL type font, 1981.

A quad name or system name is a general term for built-ins denoted by a name beginning with the quad character, . 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. by itself (standard output/evaluated input) and (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 ⎕a in APLX), though most traditionally uppercase them. One of the most commonly system variables is ⎕IO (Index origin).

Classes

Quad names can have any of the existing syntactic classes:

  • System constants are handy values like the alphabet (⎕A), but can also be used to query various global states, like the current time stamp (⎕TS). 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 (⎕PP).
  • System objects are references to namespaces, in particular the session object (⎕SE).
  • System functions are various utility functions, like ⎕FX 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 (⎕S and ⎕R).

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 and syntactically act like variables, they have the side effect of printing whatever is assigned to them, to stdout and stderr respectively.
  • ⎕OFF and ⎕CLEAR behave syntactically as constants, although when querying their value, the interpreter will shut down or clear the workspace, respectively.
  • Variant, ⎕OPT (which is a synonym of the primitive operator ), 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, ⎕BASE, 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; ⎕BASE.⎕THIS.

External links

Lessons

Documentation

APL features [edit]
Built-ins Primitives (functions, operators) ∙ Quad name
Array model ShapeRankDepthBoundIndex (Indexing) ∙ AxisRavelRavel orderElementScalarVectorMatrixSimple scalarSimple arrayNested arrayCellMajor cellSubarrayEmpty arrayPrototype
Data types Number (Boolean, Complex number) ∙ Character (String) ∙ BoxNamespaceFunction array
Concepts and paradigms Conformability (Scalar extension, Leading axis agreement) ∙ Scalar function (Pervasion) ∙ Identity elementComplex floorArray ordering (Total) ∙ Tacit programming (Function composition, Close composition) ∙ GlyphLeading axis theoryMajor cell search
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR
APL built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector