| Line 22: |
Line 22: |
| | | | |
| | 4 | | 4 |
| | + | |
| | + | Array.partitiononcondition gives the same with matching and unmatching as two separate arrays. |
| | + | |
| | + | ==Related== |
| | + | |
| | + | Array.collectwhile=Array.filteroncondition with SomeTakeDropOrAllFlag (0); |
| | + | |
| | + | Array.suchthat=Array.filteroncondition with SomeTakeDropOrAllFlag (0); |
| | + | |
| | + | Array.collect=Array.suchthat as previous; |
| | + | |
| | + | Array.takewhile=Array.filteroncondition with SomeTakeDropOrAllFlag(1); |
| | + | |
| | + | Array.dropwhile=Array.filteroncondition with SomeTakeDropOrAllFlag(2); |
| | + | |
| | + | |
| | + | |
| | + | Array.collectwhileasvector=Array.filteroncondition with SomeTakeDropOrAllFlag(10); |
| | + | |
| | + | Array.suchthatasvector=Array.filteroncondition with SomeTakeDropOrAllFlag(10); |
| | + | |
| | + | Array.collectasvector=Array.suchthatasvector; as previous |
| | + | |
| | + | Array.takewhileasvector=Array.filteroncondition with SomeTakeDropOrAllFlag(11); |
| | + | |
| | + | Array.dropwhileasvector=Array.filteroncondition with SomeTakeDropOrAllFlag(12); |
| | + | |
| | + | |
| | + | |
| | + | Array.prototype.splitwhile=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(0); |
| | + | Array.prototype.splitwhileasvector=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(10); |
| | + | |
| | + | |
| | + | Please note that "asvector" implies each row in the array is treated as one to check the condition (like a vector). |
| | + | |
| | + | For example, [1..10,2..3].collectwhileasvector("x[0]<5") will give the answer as the input itself, because in both rows, x[0] <5 is true. Here for each vector (or row), the function is applied to check if it should be collected or not. |
| | + | |
| | + | Generally the flag means: |
| | + | |
| | + | 0 or 1 means take |
| | + | |
| | + | 2 means drop |
| | + | |
| | + | 10 or 11 means take as vector (flattened) |
| | + | |
| | + | 12 means drop take as vector (flattened) |