Cut (K): Difference between revisions

From APL Wiki
Jump to navigation Jump to search
m (Primitive function category)
 
(2 intermediate revisions by the same user not shown)
Line 4: Line 4:


When the left argument to <code>_</code> is a single value rather than a list, it indicates [[Drop]] rather than Cut. Cut has some resemblance to Drop in that it omits every element whose index is less than the first element of the left argument.
When the left argument to <code>_</code> is a single value rather than a list, it indicates [[Drop]] rather than Cut. Cut has some resemblance to Drop in that it omits every element whose index is less than the first element of the left argument.
 
== See also ==
Cut is related to [[Partition]] and [[Partitioned Enclose]]; see [[Partition representations]].
* [[Partition]]
* [[Partitioned Enclose]]
* [[Partition representations]]


== External Links ==
== External Links ==
Line 11: Line 13:
=== Documentation ===
=== Documentation ===


* [https://k.miraheze.org/wiki/Cut The K Language Wiki]
* [https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md#user-content-floor oK]
* [https://github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md#user-content-floor oK]
 
{{APL built-ins}}
[[Category:Primitive functions]]
[[Category:Primitive functions]]

Latest revision as of 07:01, 8 September 2022

For the operator used in A Dictionary of APL and J, see Cut.
_

Cut (_) is a dyadic primitive function in K which partitions its right argument by its left in the same sense as Partition. The left argument must be a non-decreasing vector of integers between 0 and the count of the right argument, inclusive (unlike indices with K's index origin of 0, the count itself is allowed). Each entry of the left argument indicates that a new partition should start just before that index in the right argument. When more than one partition is started in the same place, all but the last is left empty. Values before the first break are not included in the result.

When the left argument to _ is a single value rather than a list, it indicates Drop rather than Cut. Cut has some resemblance to Drop in that it omits every element whose index is less than the first element of the left argument.

See also

External Links

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