Cut (K): Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{{Built-in|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 [[Index|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. | {{Built-in|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 [[Index|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 < | 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. | ||
Cut is related to [[Partition]] and [[Partitioned Enclose]] | Cut is related to [[Partition]] and [[Partitioned Enclose]]; see [[Partition representations]]. | ||
== External Links == | == External Links == |
Revision as of 21:12, 6 January 2020
_
|
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.
Cut is related to Partition and Partitioned Enclose; see Partition representations.