Migration level: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
Miraheze>Adám Brudzewsky
mNo edit summary
Miraheze>Marshall
(Capitalize primitive names)
Line 12: Line 12:
| <source lang=apl inline>⎕ML=0</source>
| <source lang=apl inline>⎕ML=0</source>
| <source lang=apl inline>Z←∊R</source>
| <source lang=apl inline>Z←∊R</source>
| Monadic <source lang=apl inline>∊</source> is interpreted as [[type]] rather than [[enlist]].
| Monadic <source lang=apl inline>∊</source> is interpreted as [[Type]] rather than [[Enlist]].
|-
|-
| <source lang=apl inline>⎕ML=1</source>
| <source lang=apl inline>⎕ML=1</source>
Line 20: Line 20:
| rowspan=3 | <source lang=apl inline>⎕ML≤2</source>
| rowspan=3 | <source lang=apl inline>⎕ML≤2</source>
| <source lang=apl inline>Z←↑R</source>
| <source lang=apl inline>Z←↑R</source>
| Monadic <source lang=apl inline>↑</source> is interpreted as [[first]] rather than [[mix]].
| Monadic <source lang=apl inline>↑</source> is interpreted as [[First]] rather than [[Mix]].
|-
|-
| <source lang=apl inline>Z←⊃R</source>
| <source lang=apl inline>Z←⊃R</source>
| Monadic <source lang=apl inline>⊃</source> is interpreted as [[mix]] rather than [[first]].
| Monadic <source lang=apl inline>⊃</source> is interpreted as [[Mix]] rather than [[First]].
|-  
|-  
| <source lang=apl inline>Z←≡R</source>
| <source lang=apl inline>Z←≡R</source>
Line 30: Line 30:
| rowspan=2| <source lang=apl inline>⎕ML=3</source>
| rowspan=2| <source lang=apl inline>⎕ML=3</source>
| <source lang=apl inline>R←X⊂[K]Y</source>
| <source lang=apl inline>R←X⊂[K]Y</source>
| Dyadic <source lang=apl inline>⊂</source> is interpreted as [[partition]] (<source lang=apl inline>⊆</source>) rather than [[partitioned enclose]].
| Dyadic <source lang=apl inline>⊂</source> is interpreted as [[Partition]] (<source lang=apl inline>⊆</source>) rather than [[Partitioned Enclose]].
|-  
|-  
| <source lang=apl inline>⎕TC</source>
| <source lang=apl inline>⎕TC</source>
Line 37: Line 37:


=== Work-arounds ===
=== Work-arounds ===
When migrating to Dyalog APL, the below drop-ins for the affected [[built-ins]] allow setting <source 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.
When migrating to Dyalog APL, the below drop-ins for the affected [[built-in]]s allow setting <source 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

Revision as of 11:13, 15 November 2019

⎕ML ⎕EL

Migration level (⎕ML, ⎕EL) or Evolution level is a number that, in Dyalog APL and APL+Win respectively, determines exact where the original NARS specification and the current APL2 implementation differ. A lower value represents a behaviour closer to NARS, while a higher the value represents a behaviour closer to APL2.

APL+Win settings

[TBD]

Dyalog settings

Dyalog APL currently offers the following settings:

⎕ML=0 Z←∊R Monadic is interpreted as Type rather than Enlist.
⎕ML=1 Default behaviour
⎕ML≤2 Z←↑R Monadic is interpreted as First rather than Mix.
Z←⊃R Monadic is interpreted as Mix rather than First.
Z←≡R Monadic returns a positive rather than a negative value, if its argument has non-uniform depth.
⎕ML=3 R←X⊂[K]Y Dyadic is interpreted as Partition () rather than Partitioned Enclose.
⎕TC The order of the elements of ⎕TC is the same as in APL2.

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.

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