Migration level

From APL Wiki
(Redirected from Evolution level)
Jump to navigation Jump to search
⎕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 built-ins [edit]
Primitives (Timeline) Functions
Scalar
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare RootRound
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
Non-Scalar
Structural ShapeReshapeTallyDepthRavelEnlistTableCatenateReverseRotateTransposeRazeMixSplitEncloseNestCut (K)PairLinkPartitioned EnclosePartition
Selection FirstPickTakeDropUniqueIdentityStopSelectReplicateExpandSet functions (IntersectionUnionWithout) ∙ Bracket indexingIndexCartesian ProductSort
Selector Index generatorGradeIndex OfInterval IndexIndicesDealPrefix and suffix vectors
Computational MatchNot MatchMembershipFindNub SieveEncodeDecodeMatrix InverseMatrix DivideFormatExecuteMaterialiseRange
Operators Monadic EachCommuteConstantReplicateExpandReduceWindowed ReduceScanOuter ProductKeyI-BeamSpawnFunction axisIdentity (Null, Ident)
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)Identity (Lev, Dex)
Quad names Index originComparison toleranceMigration levelAtomic vector
APL glyphs [edit]
Information GlyphTyping glyphs (on Linux) ∙ UnicodeFontsMnemonicsOverstrikesMigration level
Individual glyphs Jot () ∙ Right Shoe () ∙ Up Arrow () ∙ Zilde () ∙ High minus (¯) ∙ Dot (.) ∙ Del ()