Difference between revisions of "Array.filteroncondition()"

From ZCubes Wiki
Jump to navigation Jump to search
Line 51: Line 51:
 
Array.prototype.splitwhile=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(0);
 
Array.prototype.splitwhile=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(0);
 
Array.prototype.splitwhileasvector=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(10);
 
Array.prototype.splitwhileasvector=Array.prototype.partitiononcondition with SomeTakeDropOrAllFlag(10);
 +
 +
 +
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)

Revision as of 15:57, 14 April 2020

Array Filter Functions (SomeTakeDropOrAllFlag, SomeFunction, SomeParameter)

Array.filteroncondition(SomeTakeDropOrAllFlag, SomeFunction, SomeParameter)

Apply a function to an array with parameters, and return list that matched/not matched/all Array.suchthat() is Array.filteroncondition with SomeTakeDropOrAllFlag set to 0 (Take when condition is satisfied)

Array.filteroncolumn(SomeCondition, SomeExtractColumns, SomeFilterOnColumn)

SomeExtractColumns are the columns that are extracted, and filters are applied on SomeFilterOnColumn or column 0 1..100.filteroncolumn(">5")

Array.filteronrow(SomeCondition, SomeExtractRows, SomeFilterOnRow)

SomeExtractRows are the rows that are extracted, and filters are applied on SomeFilterOnRow or row 0 [1..100].filteronrow("<5")

gives

1

2

3

4

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);


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)