Migration level: Difference between revisions
m (Text replacement - "<source" to "<syntaxhighlight") |
|||
Line 10: | Line 10: | ||
{| class=wikitable | {| class=wikitable | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=0</source> | ||
| < | | <syntaxhighlight lang=apl inline>Z←∊R</source> | ||
| Monadic < | | Monadic <syntaxhighlight lang=apl inline>∊</source> is interpreted as [[Type]] rather than [[Enlist]]. | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=1</source> | ||
| | | | ||
| Default behaviour | | Default behaviour | ||
|- | |- | ||
| rowspan=3 | < | | rowspan=3 | <syntaxhighlight lang=apl inline>⎕ML≥2</source> | ||
| < | | <syntaxhighlight lang=apl inline>Z←↑R</source> | ||
| Monadic < | | Monadic <syntaxhighlight lang=apl inline>↑</source> is interpreted as [[First]] rather than [[Mix]]. | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>Z←⊃R</source> | ||
| Monadic < | | Monadic <syntaxhighlight lang=apl inline>⊃</source> is interpreted as [[Mix]] rather than [[First]]. | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>Z←≡R</source> | ||
| Monadic < | | Monadic <syntaxhighlight lang=apl inline>≡</source> returns a positive rather than a negative value, if its argument has non-uniform [[depth]]. | ||
|- | |- | ||
| rowspan=2| < | | rowspan=2| <syntaxhighlight lang=apl inline>⎕ML=3</source> | ||
| < | | <syntaxhighlight lang=apl inline>R←X⊂[K]Y</source> | ||
| Dyadic < | | Dyadic <syntaxhighlight lang=apl inline>⊂</source> is interpreted as [[Partition]] (<syntaxhighlight lang=apl inline>⊆</source>) rather than [[Partitioned Enclose]]. | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕TC</source> | ||
| The order of the elements of < | | The order of the elements of <syntaxhighlight lang=apl inline>⎕TC</source> is the same as in APL2. | ||
|} | |} | ||
=== Work-arounds === | === Work-arounds === | ||
When migrating to Dyalog APL, the below drop-ins for the affected [[built-ins]] allow setting < | When migrating to Dyalog APL, the below drop-ins for the affected [[built-ins]] allow setting <syntaxhighlight lang=apl inline>⎕ML←1</source> while preserving code behaviour. It is then safe to programmatically (as shown in the rightmost column) change all occurrences of the affected built-ins with their respective covers. | ||
{| class=wikitable | {| class=wikitable | ||
! Migrating from !! Define !! Then run this on all code | ! Migrating from !! Define !! Then run this on all code | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=0</source> | ||
| < | | <syntaxhighlight lang=apl>Epsilon←{×⎕NC'⍺':⍺∊⍵ ⋄ ⊃0⍴⊂⍵}</source> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '∊'⎕R'&' 'Epsilon'</source> | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=2</source> | ||
| < | | <syntaxhighlight lang=apl> | ||
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | ||
RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | ||
EqualUnderbar←|≡ | EqualUnderbar←|≡ | ||
</source> | </source> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '↑' '⊃' '≡'⎕R'&' 'UpArrow' 'RightShoe' 'EqualUnderbar'</source> | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=3</source> | ||
| < | | <syntaxhighlight lang=apl> | ||
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | ||
RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | ||
Line 62: | Line 62: | ||
quadTC←(⎕UCS 8 13 10) | quadTC←(⎕UCS 8 13 10) | ||
</source> | </source> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '↑' '⊃' '≡' '⊂' '⎕TC'⎕R'&' 'UpArrow' 'RightShoe' 'EqualUnderbar' 'LeftShoe' ' quadTC'</source> | ||
|} | |} | ||
Alternatively, the definitions can be used directly inside the text substitutions, whereby one avoids polluting existing code with these cover names. | Alternatively, the definitions can be used directly inside the text substitutions, whereby one avoids polluting existing code with these cover names. | ||
Line 71: | Line 71: | ||
{|class=wikitable | {|class=wikitable | ||
| < | | <syntaxhighlight lang=apl inline>⎕CS←1</source> || [[Strand notation|Stranding]] is done before [[bracket indexing]] | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕CS←2</source> || The [[name class]] of an invalid name is 4 rather than ¯1. | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕CS←4</source> || Format (<syntaxhighlight lang=apl inline>⍕</source>) and default output uses the same width for all columns, rather than determining the width separately for each column. | ||
|} | |} | ||
Revision as of 22:20, 10 September 2022
⎕ML ⎕EL ⎕CS
|
Migration level (⎕ML
, ⎕EL
, ⎕CS
), Evolution level, or Compatibility setting is a number that, in Dyalog APL, APL+Win, and APLX respectively, specifies exact behaviour relative to APL2. In Dyalog APL and APL+Win, a lower value represents a behaviour closer to the original NARS specification, while a higher the value represents a behaviour closer to APL2. In APLX, a lower value matches APL2 while a higher value indicates higher backwards compatibility with APL.68000.
APL+Win settings
[TBD]
Dyalog settings
Dyalog APL currently offers the following settings:
<syntaxhighlight lang=apl inline>⎕ML=0</source> | <syntaxhighlight lang=apl inline>Z←∊R</source> | Monadic <syntaxhighlight lang=apl inline>∊</source> is interpreted as Type rather than Enlist. |
<syntaxhighlight lang=apl inline>⎕ML=1</source> | Default behaviour | |
<syntaxhighlight lang=apl inline>⎕ML≥2</source> | <syntaxhighlight lang=apl inline>Z←↑R</source> | Monadic <syntaxhighlight lang=apl inline>↑</source> is interpreted as First rather than Mix. |
<syntaxhighlight lang=apl inline>Z←⊃R</source> | Monadic <syntaxhighlight lang=apl inline>⊃</source> is interpreted as Mix rather than First. | |
<syntaxhighlight lang=apl inline>Z←≡R</source> | Monadic <syntaxhighlight lang=apl inline>≡</source> returns a positive rather than a negative value, if its argument has non-uniform depth. | |
<syntaxhighlight lang=apl inline>⎕ML=3</source> | <syntaxhighlight lang=apl inline>R←X⊂[K]Y</source> | Dyadic <syntaxhighlight lang=apl inline>⊂</source> is interpreted as Partition (<syntaxhighlight lang=apl inline>⊆</source>) rather than Partitioned Enclose. |
<syntaxhighlight lang=apl inline>⎕TC</source> | The order of the elements of <syntaxhighlight lang=apl inline>⎕TC</source> is the same as in APL2. |
Work-arounds
When migrating to Dyalog APL, the below drop-ins for the affected built-ins allow setting <syntaxhighlight lang=apl inline>⎕ML←1</source> while preserving code behaviour. It is then safe to programmatically (as shown in the rightmost column) change all occurrences of the affected built-ins with their respective covers.
Migrating from | Define | Then run this on all code |
---|---|---|
<syntaxhighlight lang=apl inline>⎕ML=0</source> | <syntaxhighlight lang=apl>Epsilon←{×⎕NC'⍺':⍺∊⍵ ⋄ ⊃0⍴⊂⍵}</source> | <syntaxhighlight lang=apl inline>[^]+ '∊'⎕R'&' 'Epsilon'</source> |
<syntaxhighlight lang=apl inline>⎕ML=2</source> | <syntaxhighlight lang=apl>
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} EqualUnderbar←|≡ </source> |
<syntaxhighlight lang=apl inline>[^]+ '↑' '⊃' '≡'⎕R'&' 'UpArrow' 'RightShoe' 'EqualUnderbar'</source> |
<syntaxhighlight lang=apl inline>⎕ML=3</source> | <syntaxhighlight lang=apl>
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} EqualUnderbar←(|≡) LeftShoe←{×⎕NC'⍺':⍺⊆⍵ ⋄ ⊂⍵} quadTC←(⎕UCS 8 13 10) </source> |
<syntaxhighlight lang=apl inline>[^]+ '↑' '⊃' '≡' '⊂' '⎕TC'⎕R'&' 'UpArrow' 'RightShoe' 'EqualUnderbar' 'LeftShoe' ' quadTC'</source> |
Alternatively, the definitions can be used directly inside the text substitutions, whereby one avoids polluting existing code with these cover names.
APLX settings
APLX treats the value as a collection of individual bits, thus allowing the combination of an exact set of behaviours:
<syntaxhighlight lang=apl inline>⎕CS←1</source> | Stranding is done before bracket indexing |
<syntaxhighlight lang=apl inline>⎕CS←2</source> | The name class of an invalid name is 4 rather than ¯1. |
<syntaxhighlight lang=apl inline>⎕CS←4</source> | Format (<syntaxhighlight lang=apl inline>⍕</source>) and default output uses the same width for all columns, rather than determining the width separately for each column. |
External links
Documentation
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 (∇ )
|