Disclose: Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Marshall moved page Disclose (disambiguation) to Disclose over a redirect without leaving a redirect: wikipedia:wikipedia:Broad-concept article fits this better than a disambiguation page)
(Clean up, and avoid claiming up arrow can mean Disclose as it's never associated with that name)
 
(2 intermediate revisions by 2 users not shown)
Line 4: Line 4:
* [[Mix]], a function combining its argument's elements (requiring conforming shapes or padding with [[fill element]]s).
* [[Mix]], a function combining its argument's elements (requiring conforming shapes or padding with [[fill element]]s).


Early experiments in array nesting usually defined a primitive to extract the contents of a nested [[scalar]], but did not always specify how it should behave on an array. [[Jim Brown]]'s "A Generalization of APL",<ref>[[Jim Brown]]. [http://www.softwarepreservation.org/projects/apl/Books/AGENERALIZATIONOFAPL "A Generalization of APL"] (Ph.D. thesis). 1971.</ref> stated that it "may be undefined" on non-scalar arrays. However, all dialects do define it on non-scalars, but with differing definitions.
These two meanings are distributed among the [[glyphs]] [[Right Shoe]] (<syntaxhighlight lang=apl inline>⊃</syntaxhighlight>) and [[Up Arrow]] (<syntaxhighlight lang=apl inline>↑</syntaxhighlight>) in nested APLs; the name "Disclose" is usually used for whichever meaning is represented by <syntaxhighlight lang=apl inline>⊃</syntaxhighlight> and never for the one represented by <syntaxhighlight lang=apl inline>↑</syntaxhighlight>, which is called "First" or "Mix".
 
In the [[SHARP APL]] family, the behavior of Mix follows automatically by giving Disclose a [[function rank]] of 0. Disclose returns the contents of each [[box]] in an array, and rank treats these results as the cells of a result array.
 
== History ==
== History ==
The two [[glyph]]s commonly used for Disclose are [[Right Shoe]] and [[Up Arrow]]. The original [[NARS]] paper specified monadic <syntaxhighlight lang=apl inline></syntaxhighlight> as Mix and <syntaxhighlight lang=apl inline></syntaxhighlight> as First, so [[Dyalog]] and [[STSC]] implemented [[Dyalog APL]] and [[APL*PLUS]] accordingly. [[IBM]] decided to swap them in [[APL2]], causing the others to implement [[Migration Level]], as APL2 was seen as the authoritative implementation. When the ISO [[standard]] was written, it closely followed APL2, causing [[APLX]], [[NARS2000]], [[GNU APL]], and [[ngn/apl]] to adopt these notations. However, ngn/apl later switched to follow Dyalog.
 
Early experiments in array nesting usually defined a primitive to extract the contents of a nested [[scalar]], but did not always specify how it should behave on an array. [[Jim Brown]]'s "A Generalization of APL"<ref>[[Jim Brown]]. [http://www.softwarepreservation.org/projects/apl/Books/AGENERALIZATIONOFAPL "A Generalization of APL"] (Ph.D. thesis). 1971.</ref> stated that it "may be undefined" on non-scalar arrays. However, all dialects do extend it to non-scalars, either as First or Mix.
 
[[STSC]]'s [[NARS]], the first nested APL released, defined Disclose <syntaxhighlight lang=apl inline></syntaxhighlight> to be First, leaving monadic <syntaxhighlight lang=apl inline></syntaxhighlight> as Mix, and [[Dyalog APL]] followed this choice. But [[IBM]] later released [[APL2]] with the definitions the other way around, a choice eventually adopted by the nested APL standard [[ISO/IEC 13751:2001]]. Due to the perceived authority of APL2, later dialects such as [[APLX]], [[NARS2000]], and [[GNU APL]] generally follow the APL2 definition, and Dyalog as well as STSC's [[APL*PLUS]] implement [[Migration Level]] to allow programs to select it. However, the NARS definition remains the default in Dyalog, causing it to be adopted by some dialects such as [[April]], [[dzaima/APL]], and [[ngn/apl]].


== References ==
== References ==
<references/>
<references/>
{{APL built-ins}}[[Category:Primitive functions]]
{{APL built-ins}}[[Category:Primitive functions]]

Latest revision as of 21:14, 19 February 2024

Disclose () or Reveal is a monadic function in nested APLs which reduces the level of nesting of an array. It may refer to:

  • First, a the function extracting its argument's initial element in ravel order.
  • Mix, a function combining its argument's elements (requiring conforming shapes or padding with fill elements).

These two meanings are distributed among the glyphs Right Shoe () and Up Arrow () in nested APLs; the name "Disclose" is usually used for whichever meaning is represented by and never for the one represented by , which is called "First" or "Mix".

In the SHARP APL family, the behavior of Mix follows automatically by giving Disclose a function rank of 0. Disclose returns the contents of each box in an array, and rank treats these results as the cells of a result array.

History

Early experiments in array nesting usually defined a primitive to extract the contents of a nested scalar, but did not always specify how it should behave on an array. Jim Brown's "A Generalization of APL"[1] stated that it "may be undefined" on non-scalar arrays. However, all dialects do extend it to non-scalars, either as First or Mix.

STSC's NARS, the first nested APL released, defined Disclose to be First, leaving monadic as Mix, and Dyalog APL followed this choice. But IBM later released APL2 with the definitions the other way around, a choice eventually adopted by the nested APL standard ISO/IEC 13751:2001. Due to the perceived authority of APL2, later dialects such as APLX, NARS2000, and GNU APL generally follow the APL2 definition, and Dyalog as well as STSC's APL*PLUS implement Migration Level to allow programs to select it. However, the NARS definition remains the default in Dyalog, causing it to be adopted by some dialects such as April, dzaima/APL, and ngn/apl.

References

  1. Jim Brown. "A Generalization of APL" (Ph.D. thesis). 1971.
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