Cut

From APL Wiki
Jump to navigation Jump to search
For the K primitive function, see Cut (K).

Cut (), or ;. in J, is a primitive dyadic operator first defined in Rationalized APL and implemented in SHARP APL. It provides several functions that slice an argument into subarrays in various ways, selected by an integer operand that ranges from -3 to 3. In APL this operand is the left operand, while in J it's the right operand. The other operand is a function to be applied to each subarray. The results of this function are then mixed to give the overall result.

  • With operand 0, rank-2 cells of the left argument specify subarrays of the right argument by multi-dimensional index.
  • With operand ±1, or ±2, the right argument is partitioned much like Partitioned Enclose. A boolean left argument specifies positions at which to cut, or, in the monadic case, these positions are the instances of the first (±1) or last (±2) cell of the argument. A negative number indicates that the cells at these positions should be left out of the slices that would contain them.
  • With operand ±3, regularly-spaced subarrays are selected, as in Stencil. These subarrays have a specified size, but with operand 3, arrays that are cut off by the end of the argument and hence have a smaller size are allowed, while with -3 they are omitted.

See also

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