Cut
Revision as of 19:34, 31 January 2024 by Marshall (talk | contribs) (Created page with ":''For the K primitive function, see Cut (K).'' {{Built-in|Cut|⍤}}, or <syntaxhighlight lang=j inline>;.</syntaxhighlight> 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 ope...")
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
- J NuVoc, Dictionary