Direct definition (operator)

From APL Wiki
(Redirected from Direct definition operator)
Jump to navigation Jump to search
The Del glyph is more commonly used for dfn recursion or to indicate a defined function.

Direct definition (), or function definition, is a primitive dyadic operator that defines an anonymous function based on source strings. Its left operand is the source for the function's dyadic case and the right is the source for the monadic case. It appears in NARS and several publications by Ken Iverson: an APL81 paper with Peter Wooster,[1] Rationalized APL, and A Dictionary of APL. Definitions vary, but in all cases, the format of a source string is similar to that used in the informal direct definition notation, with and for the left and right arguments. Another token, _ in NARS and in Iverson's papers, is added to indicate recursion. Multiple expressions can be used by separating with . Various forms of control flow have been defined.

In NARS, operands are single strings, and one of them may be replaced with a Jot (using this operator as an operand as with Outer Product) to indicate an undefined case and create a strictly monadic or dyadic function. Conditions are indicated with colons : as in direct definition notation, but the mechanism is extended: rather than a boolean condition placed between false and true cases, it's placed first, and returns a scalar or vector of natural numbers. Each number indicates one of the following groups of statements (separated by further :s and numbered starting at 0), and these groups will then be evaluated, with the result of the last evaluated expression returned from the function as a whole.

Documentation

References

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