Migration level: Difference between revisions
m (Text replacement - "http://help.dyalog.com" to "https://help.dyalog.com") |
|||
(10 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
{{Built- | {{Built-ins3|Migration level|⎕ML|)EvLevel|⎕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 == | == APL+Win settings == | ||
[ | APL+Win's default is <syntaxhighlight lang=apl inline>)EvLevel 2</syntaxhighlight>. | ||
{|class=wikitable | |||
! Feature | |||
! <syntaxhighlight lang=apl inline>)EvLevel 0</syntaxhighlight> | |||
! <syntaxhighlight lang=apl inline>)EvLevel 1</syntaxhighlight> | |||
! <syntaxhighlight lang=apl inline>)EvLevel 2</syntaxhighlight> | |||
|- | |||
| Dyadic <syntaxhighlight lang=apl inline>⊂</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Partitioned Enclose]] | |||
| [[Partition]] | |||
|- | |||
| Monadic <syntaxhighlight lang=apl inline>↓</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Split]] | |||
| [[SYNTAX ERROR]] | |||
|- | |||
| Monadic <syntaxhighlight lang=apl inline>∊</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Type]] | |||
| [[Enlist]] | |||
|- | |||
| Monadic <syntaxhighlight lang=apl inline>↑</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Mix]] | |||
| [[First]] | |||
|- | |||
| Monadic <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[First]] | |||
| [[Mix]] | |||
|- | |||
| [[Bracket indexing]] of a [[strand]] | |||
| [[EVOLUTION ERROR]] | |||
| indexing applied to strand as a whole | |||
| [[EVOLUTION ERROR]] | |||
|- | |||
| Unparenthesised [[strand]] [[assignment]] | |||
| [[EVOLUTION ERROR]] | |||
| assigned value distributed to names | |||
| [[EVOLUTION ERROR]] | |||
|- | |||
| <syntaxhighlight lang=apl inline>(/)</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Replicate]] [[function]] | |||
| [[EVOLUTION ERROR]] | |||
|- | |||
| <syntaxhighlight lang=apl inline>(\)</syntaxhighlight> | |||
| [[EVOLUTION ERROR]] | |||
| [[Expand]] [[function]] | |||
| [[EVOLUTION ERROR]] | |||
|} | |||
=== Work-arounds === | |||
APL+Win provides [[system function]] alternatives to the functions that are affected by moving to evolution level 2: | |||
{|class=wikitable | |||
| [[Partitioned Enclose]] | |||
| <syntaxhighlight lang=apl inline>⎕PENCLOSE</syntaxhighlight> | |||
|- | |||
| [[Split]] | |||
| <syntaxhighlight lang=apl inline>⎕SPLIT</syntaxhighlight> | |||
|- | |||
| [[Type]] | |||
| <syntaxhighlight lang=apl inline>⎕TYPE</syntaxhighlight> | |||
|- | |||
| [[Mix]] | |||
| <syntaxhighlight lang=apl inline>⎕MIX</syntaxhighlight> | |||
|- | |||
| [[First]] | |||
| <syntaxhighlight lang=apl inline>⎕FIRST</syntaxhighlight> | |||
|- | |||
| [[Replicate]] [[function]] | |||
| <syntaxhighlight lang=apl inline>⎕REPL</syntaxhighlight> | |||
|- | |||
| [[Expand]] [[function]] | |||
| <syntaxhighlight lang=apl inline>⎕EXPAND</syntaxhighlight> | |||
|} | |||
== Dyalog settings == | == Dyalog settings == | ||
Dyalog | Dyalog's default setting is currently <syntaxhighlight lang=apl inline>⎕ML=1</syntaxhighlight>. | ||
{| class=wikitable | {| class=wikitable | ||
! Feature !! <syntaxhighlight lang=apl inline>⎕ML←0</syntaxhighlight> !! <syntaxhighlight lang=apl inline>⎕ML←1</syntaxhighlight> !! <syntaxhighlight lang=apl inline>⎕ML←2</syntaxhighlight> !! <syntaxhighlight lang=apl inline>⎕ML←3</syntaxhighlight> | |||
|- | |||
| Monadic < | | Monadic <syntaxhighlight lang=apl inline>∊</syntaxhighlight> | ||
| [[Type]] | |||
| [[Enlist]] | |||
| [[Enlist]] | |||
| [[Enlist]] | |||
|- | |- | ||
| < | | Monadic <syntaxhighlight lang=apl inline>↑</syntaxhighlight> | ||
| | | [[Mix]] | ||
| | | [[Mix]] | ||
| [[First]] | |||
| [[First]] | |||
|- | |- | ||
| | | Monadic <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> | ||
| | | [[First]] | ||
| | | [[First]] | ||
| [[Mix]] | |||
| [[Mix]] | |||
|- | |- | ||
| Monadic <syntaxhighlight lang=apl inline>≡</syntaxhighlight> on array of uneven [[depth]] | |||
| Monadic < | | negative result | ||
| negative result | |||
| positive result | |||
| positive result | |||
|- | |- | ||
| < | | Dyadic <syntaxhighlight lang=apl inline>⊂</syntaxhighlight> | ||
| | | [[Partitioned enclose]] | ||
| [[Partitioned enclose]] | |||
| [[Partitioned enclose]] | |||
| [[Partition]] | |||
|- | |- | ||
| <syntaxhighlight lang=apl inline>⎕TC</syntaxhighlight> | |||
| < | | <syntaxhighlight lang=apl inline>⎕UCS 8 10 13</syntaxhighlight> | ||
| | | <syntaxhighlight lang=apl inline>⎕UCS 8 10 13</syntaxhighlight> | ||
| <syntaxhighlight lang=apl inline>⎕UCS 8 10 13</syntaxhighlight> | |||
| < | | <syntaxhighlight lang=apl inline>⎕UCS 8 13 10</syntaxhighlight> | ||
| | |||
|} | |} | ||
=== 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</syntaxhighlight> 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</syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl>Epsilon←{×⎕NC'⍺':⍺∊⍵ ⋄ ⊃0⍴⊂⍵}</syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '∊'⎕R'&' ' Epsilon '</syntaxhighlight> | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=2</syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl> | ||
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | ||
RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | ||
EqualUnderbar←|≡ | EqualUnderbar←|≡ | ||
</ | </syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '↑' '⊃' '≡'⎕R'&' ' UpArrow ' ' RightShoe ' ' EqualUnderbar '</syntaxhighlight> | ||
|- | |- | ||
| < | | <syntaxhighlight lang=apl inline>⎕ML=3</syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl> | ||
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} | ||
RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} | ||
Line 61: | Line 153: | ||
LeftShoe←{×⎕NC'⍺':⍺⊆⍵ ⋄ ⊂⍵} | LeftShoe←{×⎕NC'⍺':⍺⊆⍵ ⋄ ⊂⍵} | ||
quadTC←(⎕UCS 8 13 10) | quadTC←(⎕UCS 8 13 10) | ||
</ | </syntaxhighlight> | ||
| < | | <syntaxhighlight lang=apl inline>'''[^'']+''' '↑' '⊃' '≡' '⊂' '⎕TC'⎕R'&' ' UpArrow ' ' RightShoe ' ' EqualUnderbar ' ' LeftShoe ' ' quadTC '</syntaxhighlight> | ||
|} | |} | ||
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. | ||
== APLX settings == | |||
APLX treats the value as a collection of individual bits, thus allowing the combination of an exact set of behaviours: | |||
{|class=wikitable | |||
| <syntaxhighlight lang=apl inline>⎕CS←1</syntaxhighlight> || [[Strand notation|Stranding]] is done before [[bracket indexing]] | |||
|- | |||
| <syntaxhighlight lang=apl inline>⎕CS←2</syntaxhighlight> || The [[name class]] of an invalid name is 4 rather than ¯1. | |||
|- | |||
| <syntaxhighlight lang=apl inline>⎕CS←4</syntaxhighlight> || Format (<syntaxhighlight lang=apl inline>⍕</syntaxhighlight>) and default output uses the same width for all columns, rather than determining the width separately for each column. | |||
|} | |||
== External links == | == External links == | ||
Line 71: | Line 175: | ||
* [https://help.dyalog.com/latest/#Language/System%20Functions/ml.htm Dyalog] | * [https://help.dyalog.com/latest/#Language/System%20Functions/ml.htm Dyalog] | ||
* [http://microapl.com/apl_help/ch_020_070_140.htm APLX] | |||
{{APL built-ins}}[[Category:System constants]] | {{APL built-ins}}{{APL glyphs}}[[Category:System constants]] |
Latest revision as of 17:40, 20 February 2024
⎕ML )EvLevel ⎕CS
|
Migration level (⎕ML
, )EvLevel
, ⎕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
APL+Win's default is )EvLevel 2
.
Feature | )EvLevel 0
|
)EvLevel 1
|
)EvLevel 2
|
---|---|---|---|
Dyadic ⊂
|
EVOLUTION ERROR | Partitioned Enclose | Partition |
Monadic ↓
|
EVOLUTION ERROR | Split | SYNTAX ERROR |
Monadic ∊
|
EVOLUTION ERROR | Type | Enlist |
Monadic ↑
|
EVOLUTION ERROR | Mix | First |
Monadic ⊃
|
EVOLUTION ERROR | First | Mix |
Bracket indexing of a strand | EVOLUTION ERROR | indexing applied to strand as a whole | EVOLUTION ERROR |
Unparenthesised strand assignment | EVOLUTION ERROR | assigned value distributed to names | EVOLUTION ERROR |
(/)
|
EVOLUTION ERROR | Replicate function | EVOLUTION ERROR |
(\)
|
EVOLUTION ERROR | Expand function | EVOLUTION ERROR |
Work-arounds
APL+Win provides system function alternatives to the functions that are affected by moving to evolution level 2:
Partitioned Enclose | ⎕PENCLOSE
|
Split | ⎕SPLIT
|
Type | ⎕TYPE
|
Mix | ⎕MIX
|
First | ⎕FIRST
|
Replicate function | ⎕REPL
|
Expand function | ⎕EXPAND
|
Dyalog settings
Dyalog's default setting is currently ⎕ML=1
.
Feature | ⎕ML←0 |
⎕ML←1 |
⎕ML←2 |
⎕ML←3
|
---|---|---|---|---|
Monadic ∊
|
Type | Enlist | Enlist | Enlist |
Monadic ↑
|
Mix | Mix | First | First |
Monadic ⊃
|
First | First | Mix | Mix |
Monadic ≡ on array of uneven depth
|
negative result | negative result | positive result | positive result |
Dyadic ⊂
|
Partitioned enclose | Partitioned enclose | Partitioned enclose | Partition |
⎕TC
|
⎕UCS 8 10 13
|
⎕UCS 8 10 13
|
⎕UCS 8 10 13
|
⎕UCS 8 13 10
|
Work-arounds
When migrating to Dyalog APL, the below drop-ins for the affected built-ins allow setting ⎕ML←1
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 |
---|---|---|
⎕ML=0
|
Epsilon←{×⎕NC'⍺':⍺∊⍵ ⋄ ⊃0⍴⊂⍵} |
'''[^'']+''' '∊'⎕R'&' ' Epsilon '
|
⎕ML=2
|
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} EqualUnderbar←|≡ |
'''[^'']+''' '↑' '⊃' '≡'⎕R'&' ' UpArrow ' ' RightShoe ' ' EqualUnderbar '
|
⎕ML=3
|
UpArrow←{×⎕NC'⍺':⍺↑⍵ ⋄ ⊃⍵} RightShoe←{×⎕NC'⍺':⍺↑⍵ ⋄ ↑⍵} EqualUnderbar←(|≡) LeftShoe←{×⎕NC'⍺':⍺⊆⍵ ⋄ ⊂⍵} quadTC←(⎕UCS 8 13 10) |
'''[^'']+''' '↑' '⊃' '≡' '⊂' '⎕TC'⎕R'&' ' UpArrow ' ' RightShoe ' ' EqualUnderbar ' ' LeftShoe ' ' quadTC '
|
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:
⎕CS←1 |
Stranding is done before bracket indexing |
⎕CS←2 |
The name class of an invalid name is 4 rather than ¯1. |
⎕CS←4 |
Format (⍕ ) 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 (∇ )
|