Glyph: Difference between revisions
m (Text replacement - "<source" to "<syntaxhighlight") |
m (Text replacement - "</source>" to "</syntaxhighlight>") |
||
Line 1: | Line 1: | ||
Glyphs are the individual characters 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]]. | Glyphs are the individual characters 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]]. | ||
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>√</ | 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. | ||
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> | 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> | ||
Line 10: | Line 10: | ||
=== Bi-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>^</ | 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>⍺⍺</ | [[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>⊤</ | [[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>..</ | [[NARS2000]] uses <syntaxhighlight lang=apl inline>..</syntaxhighlight> for its [[Range]] function. | ||
== References == | == References == | ||
<references/> | <references/> |
Revision as of 22:07, 10 September 2022
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 | 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 |
APL glyphs [edit] | |
---|---|
Information | Glyph ∙ Typing glyphs (on Linux) ∙ Unicode ∙ Fonts ∙ Mnemonics ∙ Overstrikes ∙ Migration level |
Individual glyphs | Jot (∘ ) ∙ Right Shoe (⊃ ) ∙ Up Arrow (↑ ) ∙ Zilde (⍬ ) ∙ High minus (¯ ) ∙ Dot (. ) ∙ Del (∇ )
|