4,494
edits
No edit summary |
|||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
On a vector right argument, the arguments must have the same length with each element in the left argument corresponding to an element in the right argument. Partition begins a new '''division''' of its right argument whenever a left argument element is greater than its neighbour on the left (with a 0 assumed to the left of the first element): | On a vector right argument, the arguments must have the same length with each element in the left argument corresponding to an element in the right argument. Partition begins a new '''division''' of its right argument whenever a left argument element is greater than its neighbour on the left (with a 0 assumed to the left of the first element): | ||
[https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qLdP/VHf1GBXvZRHbROqNQxtH3UufNS7S/NRx/JHvWvAnC1AvhVQEVABkJWSVqJg8Ki7BSKQkllcABSshQgAjdEAUuHB6uquZal5JerqGurqwanFxZn5eQFFmSABBXX1FHV1zUddi4EKnSOBvLS8YqCA@v///w0VDBWMYPBRV5u6R6ZrYlFJhjoA Try it online!] | |||
<source lang=apl> | <source lang=apl> | ||
1 1 2 2 2 2 2⊆'HiEarth' | 1 1 2 2 2 2 2⊆'HiEarth' | ||
Line 18: | Line 20: | ||
{{Works in|[[Dyalog APL]]}} | {{Works in|[[Dyalog APL]]}} | ||
In the case where the left argument is [[Boolean]], Partition splits its right argument on runs of 0s in the left argument, allowing a very short split-on-delimiter function: | In the case where the left argument is [[Boolean]], Partition splits its right argument on runs of 0s in the left argument, allowing a very short split-on-delimiter function: | ||
[https://tio.run/##SyzI0U2pTMzJT9dNrShJzUtJTfn/qLdP/VHf1GBXvZRHbROqNQxtH3UufNS7S/NRx/JHvWvAnC1AvhVQEVABkJWSVqJg8Ki7BSKQkllcABSshQgAjdEAUuHB6uquZal5JerqGurqwanFxZn5eQFFmSABBXX1FHV1zUddi4EKnSOBvLS8YqCA@v///w0VQNBAAZU2fNTVpu6RX66QWJSqUJlfaq/OBTRF41HnAqDEo65FmqiSAA Try it online!] | |||
<source lang=apl> | <source lang=apl> | ||
1 1 1 0 1 1 1 0 1 1 1 1⊆'How are you?' | 1 1 1 0 1 1 1 0 1 1 1 1⊆'How are you?' | ||
Line 29: | Line 33: | ||
</source> | </source> | ||
{{Works in|[[Dyalog APL]]}} | {{Works in|[[Dyalog APL]]}} | ||
== See also == | |||
* [[Partitioned Enclose]] | |||
* [[Cut (K)]] | |||
* [[Partition representations]] | |||
==External links== | ==External links== | ||
===Tutorials=== | ===Tutorials=== | ||
Line 35: | Line 44: | ||
* [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Partition.htm Dyalog] | * [https://help.dyalog.com/latest/index.htm#Language/Primitive%20Functions/Partition.htm Dyalog] | ||
* [http://microapl.com/apl_help/ch_020_020_590.htm APLX] | * [http://microapl.com/apl_help/ch_020_020_590.htm APLX] | ||
{{APL built-ins}} | {{APL built-ins}}[[Category:Primitive functions]] |