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


APL built-ins [edit]
Primitives (Timeline) Functions
Monadic ConjugateNegateSignumReciprocalMagnitudeExponentialNatural LogarithmFloorCeilingFactorialNotPi TimesRollTypeImaginarySquare Root
Dyadic AddSubtractTimesDivideResiduePowerLogarithmMinimumMaximumBinomialComparison functionsBoolean functions (And, Or, Nand, Nor) ∙ GCDLCMCircularComplexRoot
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 axis
Dyadic BindCompositions (Compose, Reverse Compose, Beside, Withe, Atop, Over) ∙ Inner ProductDeterminantPowerAtUnderRankDepthVariantStencilCutDirect definition (operator)
Quad names Index originComparison toleranceMigration levelAtomic vector