Unicode: Difference between revisions

Jump to navigation Jump to search
3,949 bytes added ,  16:06, 5 February 2021
m
no edit summary
mNo edit summary
(14 intermediate revisions by 3 users not shown)
Line 1: Line 1:
The advent of '''[[wikipedia:Unicode|Unicode]]''' solved many problems with dealing with APL [[glyph|character]]s, however there was still some wiggle room as to which Unicode [[wikipedia:code point|codepoint]] were to be used in a Unicode implementation of APL, and different implementors made different choices.  This article, which documents these differences, is adapted from an original paper by [[Bob Smith]]<ref>Smith, Bob. [http://www.sudleyplace.com/APL/APL%20Characters%20and%20Their%20Aliases.pdf APL Characters and Their Aliases]. 14 Dec 2013–25 Dec 2019. Sudley Place Software.</ref> that attempted to raise awareness of these issues because the differences impede transfer of information.
The advent of '''[[wikipedia:Unicode|Unicode]]''' solved many problems with dealing with APL [[glyph|character]]s, however there was still some wiggle room as to which Unicode [[wikipedia:code point|codepoint]] were to be used in a Unicode implementation of APL, and different implementors made different choices.  This article, which documents these differences, is adapted from an original paper by [[Bob Smith]]<ref>Smith, Bob. ''APL Characters and Their Aliases''. 14 Dec 2013–25 Dec 2019. Sudley Place Software.</ref> that attempted to raise awareness of these issues because the differences impede transfer of information.


The relevant document for the APL character set is the ''APL Character Repertoire'' (ACR)<ref>ISO-IEC/JTC1/SC22/WG3. [http://std.dkuug.dk/jtc1/sc22/open/n3067.pdf N3067]: APL Character Repertoire. 28 Dec 1999.</ref>. For whatever reasons, that document never became a standard, but it does provide some guidance, and is better than each implementor making separate choices.
The relevant document for the APL character set is the ''APL Character Repertoire'' (ACR)<ref>ISO-IEC/JTC1/SC22/WG3. [http://std.dkuug.dk/jtc1/sc22/open/n3067.pdf N3067]: APL Character Repertoire. 28 Dec 1999.</ref>. For whatever reasons, that document never became a standard, but it does provide some guidance, and is better than each implementor making separate choices.


==Introduction==
==Introduction==
There are a surprising number of similar APL characters in Unicode and in several cases some implementors went one way, others the other way.  The following table lists the characters in question, along with the way [[APL2]], [[Dyalog]], [[GNU APL]], [[NARS2000]], [[ngn/apl]], and [[dzaima/APL]] behave. APL2000 states that ''Generally the default codepoint scheme for the VisualAPL product follows the IBM APL2 workstation scheme''. Please [https://aplwiki.com/index.php?title=Unicode&action=edit edit] this page if you believe there are other characters that should be included in the table.
There are a surprising number of similar APL characters in Unicode and in several cases some implementors went one way, others the other way.  The following table lists the characters in question, along with the way [[APL2]], [[Dyalog]], [[GNU APL]], [[NARS2000]], [[ngn/apl]], and [[dzaima/APL]] behave. APL2000 states that ''Generally the default codepoint scheme for the VisualAPL product follows the IBM APL2 workstation scheme''. Please [https://aplwiki.com/index.php?title=Unicode&action=edit&section=2 edit] the table if you believe there are other characters that should be included in the table, or to add another dialect.


When there are differences among APL implementations, users can become confused. They type something into one APL system, copy it to another and are greeted by a [[SYNTAX ERROR]] or the like.
When there are differences among APL implementations, users can become confused. They type something into one APL system, copy it to another and are greeted by a [[SYNTAX ERROR]] or the like.


The whole basis for the confusion in a lengthy thread on comp.lang.apl entitled ''caret vs and''<ref>[https://groups.google.com/forum/#!forum/comp.lang.apl comp.lang.apl]. [https://groups.google.com/d/msg/comp.lang.apl/LTV-HTxEZI0/DAPcTrVPnmwJ caret vs and]. 28 Oct 2013&ndash;9 Dec 2013</ref> is that in some implementations the symbol for the logical [[And]] function is U+005E only, in some implementations it's U+2227 only, and in some both characters work. The original poster encountered some APL text from the [[APL Wiki]] that had been produced by a system that supports U+005E and copied it into a system that uses U+2227 only and fails on U+005E.
The whole basis for the confusion in a lengthy thread on comp.lang.apl entitled ''caret vs and''<ref>[https://groups.google.com/forum/#!forum/comp.lang.apl comp.lang.apl]. [https://groups.google.com/d/msg/comp.lang.apl/LTV-HTxEZI0/DAPcTrVPnmwJ caret vs and]. 28 Oct 2013&ndash;9 Dec 2013</ref> was that in some implementations the symbol for the logical [[And]] function was U+005E only, in some implementations it was U+2227 only, and in some both characters worked. The original poster encountered some APL text from the [[APL Wiki]] that had been produced by a system that supports U+005E and copied it into a system that used U+2227 only and failed on U+005E.


When our systems differ in the set of acceptable characters for the same function, it serves only to confuse the end user to the detriment of the community.
When systems differ in the set of acceptable characters for the same function, it serves only to confuse the end user to the detriment of the community. The cautious APL programmer can avoid such problems by choosing symbols that work across dialects. Note that in the below table, there is exactly one universally accepted codepoint for each symbol (these have been indicated by a single "Universal" cell stretching across the row), except for And where APL2 doesn't recognise the otherwise universal U+2227. However, APL2 does not have And extended to Least Common Multiple, so it is equivalent to Times (<source lang=apl inline>×</source>) which can therefore be used instead for truly portable code.


==Comparison of implementations==
==Comparison of implementations==
{| class=wikitable  
The following characters are included have been encountered in APL code displayed somewhere on the Internet or in a PDF file. Blindly copying them into an APL [[session]] can produce an error which might well confuse the user.
! APL name !! Glyph !! Codepoint !! Unicode name !! [[APL2]] !! [[Dyalog APL]] !! [[GNU APL]] !! [[NARS2000]] !! [[ngn/apl]] !! [[dzaima/APL]] !! Monadic || Dyadic  
{| class=wikitable style=text-align:center
! APL name !! Glyph !! Codepoint !! Unicode name !! [[APL2]] !! [[Dyalog APL|Dyalog<br>APL]] !! [[GNU APL|GNU<br>APL]] !! [[NARS2000|NARS<br>2000]] !! [[ngn/apl|ngn/<br>apl]] !! [[dzaima/APL|dzaima/<br>APL]] !! Monadic || Dyadic  
|-
! rowspan=2 | Star
| <source lang=apl inline>*</source> || U+002A || Asterisk || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Exponential]] || rowspan=2 | [[Power|Power]]
|-
| <source lang=apl inline>⋆</source> || U+26AA ||Star operator || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}}
|-
! rowspan=2 | Minus
| <source lang=apl inline>-</source> || U+002D || Hyphen-minus || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Negate]] || rowspan=2 | [[Minus]]
|-
| <source lang=apl inline>−</source> || U+2212 || Minus sign || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}}
|-
! rowspan=2 | Logical And
| <source lang=apl inline>^</source> || U+005E || Circumflex accent  || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}} || rowspan=2 | || rowspan=2 | [[And]]
|-
| <source lang=apl inline>∧</source> || U+22BD || Logical And || {{No|No<ref><source lang=apl inline>×</source> (U+00D7) is a universally supported substitute</ref>}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}}
|-
! rowspan=2 | Stile
| <source lang=apl inline>|</source> || U+007C || Vertical line || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Magnitude]] || rowspan=2 | [[Residue]]
|-
| <source lang=apl inline>∣</source> || U+2212 || Divides || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}}
|-
! rowspan=2 | Tilde
| <source lang=apl inline>~</source> || U+007E || Tilde || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Not]] || rowspan=2 | [[Without]]
|-
| <source lang=apl inline>∼</source> || U+223C || Tilde operator || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
! rowspan=2 | Alpha
| <source lang=apl inline>α</source> || U+03B1 || Greek small letter Alpha || rowspan=2 | || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 colspan=2 | [[dfn|Left Argument]]
|-
| <source lang=apl inline>⍺</source> || U+237A || APL functional symbol Alpha || colspan=5 {{Yes|Universal}}
|-
! rowspan=2 | Omega
| <source lang=apl inline>ω</source> || U+03C9 || Greek small letter Omega || rowspan=2 | || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 colspan=2 | [[dfn|Right Argument]]
|-
| <source lang=apl inline>⍵</source> || U+237A || APL functional symbol Omega || colspan=5 {{Yes|Universal}}
|-
|-
! rowspan=2 | Epsilon
! rowspan=2 | Epsilon
| style=text-align:center | <source lang=apl inline>∈</source><ref>Found by Hanspeter Moser in [https://www.gnu.org/software/apl/Bits_and_Pieces/toronto-toolkit.apl.html The Toronto Toolkit]</ref> || style=text-align:center | U+2208 || Element of || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 | [[Enlist]]/[[Type]] || rowspan=2 | [[Membership]]
| <source lang=apl inline>∈</source><ref>Found by Hanspeter Moser in [https://www.gnu.org/software/apl/Bits_and_Pieces/toronto-toolkit.apl.html The Toronto Toolkit]</ref> || U+2208 || Element of || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 | [[Enlist]]/[[Type]] || rowspan=2 | [[Membership]]
|-  
|-  
| style=text-align:center | <source lang=apl inline>∊</source> || style=text-align:center | U+220A || Small Element of || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}}
| <source lang=apl inline>∊</source> || U+220A || Small Element of || colspan=6 {{Yes|Universal}}
|-
! rowspan=2 | [[Jot]]
| <source lang=apl inline>∘</source> || U+2218 || Ring operator || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Outer product]] || rowspan=2 | [[Beside]]/[[Bind]]
|-
| <source lang=apl inline>◦</source> || U+25E6 || White bullet || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
|-
! rowspan=2 | Minus
! rowspan=2 | Less than or<br>equal to
| style=text-align:center | <source lang=apl inline>-</source> || style=text-align:center | U+002D || Hyphen-minus || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || rowspan=2 | [[Negate]] || rowspan=2 | [[Minus]]
| <source lang=apl inline>≤</source> || U+2264 || Less-than or equal to || colspan=6 {{Yes|Universal}} || rowspan=2 | || rowspan=2 | [[Less than or equal to|Less than or<br>equal to]]
|-
| <source lang=apl inline></source> || U+2A7D || Less than or slanted equal to  || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
! rowspan=2 | Greater than or<br>equal to
| <source lang=apl inline>≥</source> || U+2265 || Greater than or equal to || colspan=6 {{Yes|Universal}} || rowspan=2 | || rowspan=2 | [[Greater than or equal to|Greater than or<br>equal to]]
|-
| <source lang=apl inline>⩾</source> || U+2A7E || Greater than or slanted equal to  || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
|-
| style=text-align:center | <source lang=apl inline></source> || style=text-align:center | U+2212 || Minus sign || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{Yes}} || {{No}}
! rowspan=2 | Logical Nor
| <source lang=apl inline></source> || U+22BD || Nor || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 | || rowspan=2 | [[Nor]]
|-
|-
! style=background:red;text-align:center colspan=12 | main content awaiting approval
| <source lang=apl inline>⍱</source> || U+2371 || APL functional symbol down caret tilde  || colspan=6 {{Yes|Universal}}
|-
|-
! rowspan=2 | Circle
! rowspan=2 | Logical Nand
| style=text-align:center | <source lang=apl inline></source> || style=text-align:center | U+25CB || White circle || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || rowspan=2 | [[Pi Times]] || rowspan=2 | [[Circle function|Circular]]
| <source lang=apl inline></source> || U+22BC || Nand || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}} || rowspan=2 | || rowspan=2 | [[Nand]]
|-
|-
| style=text-align:center | <source lang=apl inline></source> || style=text-align:center | U+26AA || Medium white circle || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
| <source lang=apl inline></source> || U+2372 || APL functional symbol up caret tilde  || colspan=6 {{Yes|Universal}}
|-
|-
! rowspan=4 | Diamond
! rowspan=4 | Diamond
| style=text-align:center | <source lang=apl inline>⋄</source> || style=text-align:center | U+22C4 || Diamond operator || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || {{Yes}} || rowspan=4 colspan=2 | [[Statement Separator]]
| <source lang=apl inline>⋄</source> || U+22C4 || Diamond operator || colspan=6 {{Yes|Universal}} || rowspan=4 colspan=2 | [[Statement Separator]]
|-
|-
| style=text-align:center | <source lang=apl inline>◇</source> || style=text-align:center | U+25C7 || White Diamond    || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}}
| <source lang=apl inline>◇</source> || U+25C7 || White Diamond    || {{No}} || {{No}} || {{No}} || {{Yes}} || {{No}} || {{No}}
|-
|-
| style=text-align:center | <source lang=apl inline>◊</source> || style=text-align:center | U+25CA || Lozenge          || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
| <source lang=apl inline>◊</source> || U+25CA || Lozenge          || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
|-
| style=text-align:center | <source lang=apl inline></source> || style=text-align:center | U+2B26 || Diamond          || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
| <source lang=apl inline>⬦</source> || U+2B26 || Diamond          || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
! rowspan=2 | Quad
| <source lang=apl inline>⎕</source> || U+2395 || APL functional symbol Quad  || colspan=6 {{Yes|Universal}} || rowspan=2 colspan=2 | [[Quad name]]
|-
| <source lang=apl inline>▯</source> || U+26AA || White vertical rectangle || {{Yes}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|-
! rowspan=2 | Circle
| <source lang=apl inline></source> || U+25CB || White circle || colspan=6 {{Yes|Universal}} || rowspan=2 | [[Pi Times]] || rowspan=2 | [[Circle function|Circular]]
|-
| <source lang=apl inline>⚪</source> || U+26AA || Medium white circle || {{No}} || {{No}} || {{Yes}} || {{Yes}} || {{No}} || {{No}}
|}
|}
These characters are included here because they have been encountered them in APL code displayed somewhere on the Internet or in a PDF file. Thus blindly copying them into an APL [[session]] can produce an error which might well confuse the user.


== Functionality ==
== Functionality ==
The following statements can be used to test the functionality of the symbols:
The following statements can be used to test the functionality of the symbols:
<source lang=apl>
<source lang=apl>
⍎⎕← '1',(⎕UCS 16⊥2 2 0 10),'1'  ⍝ Epsilon
⍎⎕← '1',(⎕UCS 16⊥0  0 2 10),'1'  ⍝ Star
⍎⎕← '1',(⎕UCS 16⊥2  2  0  8),'1'  ⍝ Epsilon
⍎⎕← '1',(⎕UCS 16⊥2  2 12  6),'1'  ⍝ Star
⍎⎕← '1',(⎕UCS 16⊥0 2 13),'1'  ⍝ Minus
⍎⎕← '1',(⎕UCS 16⊥2  2  1  2),'1'  ⍝ Minus
⍎⎕← '1',(⎕UCS 16⊥2  2  1  2),'1'  ⍝ Minus
⍎⎕← '1',(⎕UCS 16⊥0  0  2 13),'1'  ⍝ Minus
⍎⎕← '1',(⎕UCS 16⊥0  0 5 14),'1'  ⍝ And
⍎⎕← '1',(⎕UCS 16⊥2 2 2  7),'1'  ⍝ And
⍎⎕← '1',(⎕UCS 16⊥0  0  7 12),'1'  ⍝ Modulus
⍎⎕← '1',(⎕UCS 16⊥2  2  2  3),'1'  ⍝ Modulus
⍎⎕← '1',(⎕UCS 16⊥2  2  2  3),'1'  ⍝ Modulus
⍎⎕← '1',(⎕UCS 16⊥0  0  7 12),'1'  ⍝ Modulus
⍎⎕←     (⎕UCS 16⊥0  0  7 14),'1'  ⍝ Tilde
⍎⎕← '1',(⎕UCS 16⊥2  2 12  6),'1'  ⍝ Star
⍎⎕← '1',(⎕UCS 16⊥0  0  2 10),'1'  ⍝ Star
⍎⎕←    (⎕UCS 16⊥2  2  3 12),'1'  ⍝ Tilde
⍎⎕←    (⎕UCS 16⊥2  2  3 12),'1'  ⍝ Tilde
⍎⎕←     (⎕UCS 16⊥0  0  7 14),'1'  ⍝ Tilde
⍎⎕←'1{',(⎕UCS 16⊥0  3 11  1),'}1'  ⍝ Alpha
⍎⎕←'1{',(⎕UCS 16⊥2  3  7 10),'}1'  ⍝ Alpha
⍎⎕← '{',(⎕UCS 16⊥0 3 12  9),'}1'  ⍝ Omega
⍎⎕← '{',(⎕UCS 16⊥2  3  7  5),'}1'  ⍝ Omega
⍎⎕← '1',(⎕UCS 16⊥2  2 0 8),'1'  ⍝ Epsilon
⍎⎕← '1',(⎕UCS 16⊥2  2  0 10),'1'  ⍝ Epsilon
⍎⎕← '1',(⎕UCS 16⊥2  2  1  8),'.=1' ⍝ Jot
⍎⎕← '1',(⎕UCS 16⊥2  5 14  6),'.=1' ⍝ Jot
⍎⎕← '1',(⎕UCS 16⊥2  2  6  4),'1'  ⍝ Less than or equal to
⍎⎕← '1',(⎕UCS 16⊥2 10  7 13),'1'  ⍝ Less than or equal to
⍎⎕← '1',(⎕UCS 16⊥2  2  6  5),'1'  ⍝ Greater than or equal to
⍎⎕← '1',(⎕UCS 16⊥2 10 7 14),'1'  ⍝ Greater than or equal to
⍎⎕← '1',(⎕UCS 16⊥2  2 11 13),'1'  ⍝ Nor
⍎⎕← '1',(⎕UCS 16⊥2  3  7  1),'1'  ⍝ Nor
⍎⎕← '1',(⎕UCS 16⊥2  3  7  1),'1'  ⍝ Nor
⍎⎕← '1',(⎕UCS 16⊥2  2 11 13),'1'  ⍝ Nor
⍎⎕← '1',(⎕UCS 16⊥2  3  7  2),'1'  ⍝ Nand
⍎⎕← '1',(⎕UCS 16⊥2  2 11 12),'1'  ⍝ Nand
⍎⎕← '1',(⎕UCS 16⊥2  2 11 12),'1'  ⍝ Nand
⍎⎕← '1',(⎕UCS 16⊥2  2  2  7),'1'  ⍝ And
⍎⎕← '1',(⎕UCS 16⊥0  0  5 14),'1'  ⍝ And
⍎⎕← '1',(⎕UCS 16⊥2  2  6  4),'1'  ⍝ Not More
⍎⎕← '1',(⎕UCS 16⊥2 10  7 13),'1'  ⍝ Not More
⍎⎕← '1',(⎕UCS 16⊥2  2  6  5),'1'  ⍝ Not Less
⍎⎕← '1',(⎕UCS 16⊥2 10  7 14),'1'  ⍝ Not less
⍎⎕← '1',(⎕UCS 16⊥2  5 14  6),'.=1' ⍝ Jot
⍎⎕← '1',(⎕UCS 16⊥2  2  1  8),'.=1' ⍝ Jot
⍎⎕← '1',(⎕UCS 16⊥2  6 10 10),'1'  ⍝ Circle
⍎⎕← '1',(⎕UCS 16⊥2  5 12 11),'1'  ⍝ Circle
⍎⎕← '1',(⎕UCS 16⊥2 11  2  6),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  2 12  4),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  2 12  4),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  5 12  7),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  5 12  7),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  5 12 10),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2  5 12 10),'1'  ⍝ Diamond
⍎⎕← '1',(⎕UCS 16⊥2 11  2  6),'1'  ⍝ Diamond
⍎⎕←    (⎕UCS 16⊥2  3  9  5),'←1'  ⍝ Quad
⍎⎕←    (⎕UCS 16⊥2  5 10 15),'←1'  ⍝ Quad
⍎⎕←    (⎕UCS 16⊥2  5 10 15),'←1'  ⍝ Quad
⍎⎕←    (⎕UCS 16⊥2  3  9  5),'←1'  ⍝ Quad
⍎⎕← '1',(⎕UCS 16⊥2  5 12 11),'1'   Circle
⍎⎕←'1{',(⎕UCS 16⊥2  3  7 10),'}1' Alpha
⍎⎕← '1',(⎕UCS 16⊥2 6 10 10),'1'   Circle
⍎⎕←'1{',(⎕UCS 16⊥0 3 11  1),'}1' Alpha
⍎⎕← '1',(⎕UCS 16⊥2  3  7  2),'1'   Nand
⍎⎕← '{',(⎕UCS 16⊥2  3  7  5),'}1'  ⍝ Omega
⍎⎕← '{',(⎕UCS 16⊥0  3 12  9),'}1' Omega
</source>
</source>
Note that the last four lines will not work on a system that doesn’t support [[dfns]].
Note that the last four lines will not work on a system that doesn’t support [[dfn]]s.


==Atomic Vector==
==Atomic Vector==
Line 92: Line 150:
== References ==
== References ==
<references/>
<references/>
{{APL glyphs}}[[Category:APL character set]]

Navigation menu