Glyph: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>RikedyP
(Created page with "Glyphs are the individual characters and symbols used in APL, primarily to represent primitive functions and operators. Prior to...")
 
mNo edit summary
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
Glyphs are the individual characters and symbols used in APL, primarily to represent [[primitive function|primitive functions]] and [[primitive operator|operators]].
Glyphs are the individual [[character]]s and symbols used in APL, primarily to represent [[primitive function]]s and [[primitive operator|operators]]. A glyph is distinct from the functionality it represents, and usually has a different name: for example, the [[dyadic]] function [[Take]] is represented with the glyph [[Up Arrow]].


Prior to the widespread adoption of [https://en.wikipedia.org/wiki/Unicode Unicode], many special-purpose code pages were used to represent APL symbols (see [https://en.wikipedia.org/wiki/Digital_encoding_of_APL_symbols Wikipedia: Digital encoding of APL symbols]).
Most of APL's glyphs cannot be represented in [[wikipedia:ASCII|ASCII]], now considered a "standard" or "basic" character set, but all of them are included in [[Unicode]], as one goal of Unicode was to unify existing character sets. In fact, [[Ken Iverson]] first began using [[Iverson notation|his notation]] before work on ASCII began, and [[APL\360]] was implemented before the modern ASCII standard was published in 1967. Prior to the widespread adoption of Unicode, many [[wikipedia:Digital encoding of APL symbols|special purpose code pages]] were used to represent APL symbols. APLs developed more recently, such as [[NARS2000]] and [[GNU APL]], use Unicode characters to represent glyphs, sometimes supporting several different options for a given glyph. Unicode also offers the possibility of introducing glyphs that could not have been produced on older APL systems: for example, both [[NARS2000]] and [[dzaima/APL]] use <syntaxhighlight lang=apl inline>√</syntaxhighlight> for the [[Square Root]] and [[Root]] functions.


{{APL programming language}}
While [[Iverson notation]] was originally handwritten, the choice of glyphs to include in the first APL implementations was influenced by technical constraints of the typewriters used at the time. Notably, many glyphs were produced by overlaying two simpler glyphs, a technique known as [[overstrike|overstriking]]. The original glyph shapes in [[A Programming Language]] were drawn by [[Ken Iverson]]'s wife, Jean Iverson, using a [[wikipedia:Keuffel and Esser|Keuffel and Esser]] Leroy [[wikipedia:Technical_lettering#Mechanical_lettering|lettering set]].<ref>[[Roger Hui]]. [https://www.jsoftware.com/papers/APLQA.htm#Jean_Iverson APL Quotations and Anecdotes]. [[J]]software.</ref>
 
== Alternatives ==
 
Display problems have been mostly eliminated by the broad uptake of Unicode. However some difficulties with [[typing glyphs]] remain. Several APL-family languages such as [[J]], [[K]], and [[ELI]] have chosen to stick with ASCII, either by reducing and compacting functionality to use one character per glyph or by using multiple characters. Historically there have also been various encodings of APL in smaller character sets, typically as an alternate way of writing code for an APL with traditional glyphs.
 
=== Bi-glyphs ===
J and K use both ASCII symbols on their own, and followed by one or more periods and/or colons. J terminology calls these ''bigraphs'' and ''trigraphs''. For example, J uses <syntaxhighlight lang=j inline>^</syntaxhighlight> for [[Power]], <syntaxhighlight lang=j inline>^.</syntaxhighlight> for [[Logarithm]], and <syntaxhighlight lang=j inline>^:</syntaxhighlight> for the [[Power operator]], while K uses <code>':</code> for the equivalent of [[Windowed_Reduce#Notable_uses|pair-wise reduction]] (<syntaxhighlight lang=apl inline>¯2f/</syntaxhighlight>) and <code>0:</code> for line-by-line file read/write. Lately, J has gone beyond this and added <syntaxhighlight lang=j inline>{{</syntaxhighlight>…<syntaxhighlight lang=j inline>}}</syntaxhighlight> for explicit functions, similar to the syntax of [[dfns]].
 
[[Dyalog APL]] uses a few bi-glyphs, especially in dops (the operand equivalent of a dfn) where for example <syntaxhighlight lang=apl inline>⍺⍺</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍵⍵</syntaxhighlight> denote the left and right [[operand]]s. [[GNU APL]] and [[dzaima/APL]] use <syntaxhighlight lang=apl inline>⍶</syntaxhighlight> and <syntaxhighlight lang=apl inline>⍹</syntaxhighlight> instead.
 
[[GNU APL]] also uses bi-glyphs consisting of <syntaxhighlight lang=apl inline>⊤</syntaxhighlight> follwed by a comparison function as the bit-wise equivalent of the comparison function. For example <syntaxhighlight lang=apl inline>A⊤∧B</syntaxhighlight> is bit-wise [[And]]. [[Number]]s are treated as 64-bit integers, and [[character]]s as 32-bit integers (with the result being character as well).
 
[[NARS2000]] uses <syntaxhighlight lang=apl inline>..</syntaxhighlight> for its [[Range]] function.
== References ==
<references/>
{{APL features}}
{{APL glyphs}}
[[Category:Glyphs]]

Latest revision as of 05:22, 26 February 2024

Glyphs are the individual characters and symbols used in APL, primarily to represent primitive functions and operators. A glyph is distinct from the functionality it represents, and usually has a different name: for example, the dyadic function Take is represented with the glyph Up Arrow.

Most of APL's glyphs cannot be represented in ASCII, now considered a "standard" or "basic" character set, but all of them are included in Unicode, as one goal of Unicode was to unify existing character sets. In fact, Ken Iverson first began using his notation before work on ASCII began, and APL\360 was implemented before the modern ASCII standard was published in 1967. Prior to the widespread adoption of Unicode, many special purpose code pages were used to represent APL symbols. APLs developed more recently, such as NARS2000 and GNU APL, use Unicode characters to represent glyphs, sometimes supporting several different options for a given glyph. Unicode also offers the possibility of introducing glyphs that could not have been produced on older APL systems: for example, both NARS2000 and dzaima/APL use for the Square Root and Root functions.

While Iverson notation was originally handwritten, the choice of glyphs to include in the first APL implementations was influenced by technical constraints of the typewriters used at the time. Notably, many glyphs were produced by overlaying two simpler glyphs, a technique known as overstriking. The original glyph shapes in A Programming Language were drawn by Ken Iverson's wife, Jean Iverson, using a Keuffel and Esser Leroy lettering set.[1]

Alternatives

Display problems have been mostly eliminated by the broad uptake of Unicode. However some difficulties with typing glyphs remain. Several APL-family languages such as J, K, and ELI have chosen to stick with ASCII, either by reducing and compacting functionality to use one character per glyph or by using multiple characters. Historically there have also been various encodings of APL in smaller character sets, typically as an alternate way of writing code for an APL with traditional glyphs.

Bi-glyphs

J and K use both ASCII symbols on their own, and followed by one or more periods and/or colons. J terminology calls these bigraphs and trigraphs. For example, J uses ^ for Power, ^. for Logarithm, and ^: for the Power operator, while K uses ': for the equivalent of pair-wise reduction (¯2f/) and 0: for line-by-line file read/write. Lately, J has gone beyond this and added {{}} for explicit functions, similar to the syntax of dfns.

Dyalog APL uses a few bi-glyphs, especially in dops (the operand equivalent of a dfn) where for example ⍺⍺ and ⍵⍵ denote the left and right operands. GNU APL and dzaima/APL use and instead.

GNU APL also uses bi-glyphs consisting of follwed by a comparison function as the bit-wise equivalent of the comparison function. For example A⊤∧B is bit-wise And. Numbers are treated as 64-bit integers, and characters as 32-bit integers (with the result being character as well).

NARS2000 uses .. for its Range function.

References

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 searchFirst-class function
Errors LIMIT ERRORRANK ERRORSYNTAX ERRORDOMAIN ERRORLENGTH ERRORINDEX ERRORVALUE ERROREVOLUTION ERROR
APL glyphs [edit]
Information GlyphTyping glyphs (on Linux) ∙ UnicodeFontsMnemonicsOverstrikesMigration level
Individual glyphs Jot () ∙ Right Shoe () ∙ Up Arrow () ∙ Zilde () ∙ High minus (¯) ∙ Dot (.) ∙ Del ()