Array.collect()

From ZCubes Wiki
Revision as of 15:49, 4 February 2020 by Joseph (talk | contribs)
Jump to navigation Jump to search

Also same as Array.suchthat()


Related to 0 10 - takeall

1 11 - takewhile

2 12 - dropwhile

asvector versions work on elements/arrays at the top level. The simple versions work at every element level (goes into subarrays when need be).

Array.prototype.collectwhile=Array.prototype.filteroncondition.curry(0);

Array.prototype.suchthat=Array.prototype.filteroncondition.curry(0);

Array.prototype.collect=Array.prototype.suchthat;

Array.prototype.takewhile=Array.prototype.filteroncondition.curry(1);

Array.prototype.dropwhile=Array.prototype.filteroncondition.curry(2);


Array.prototype.collectwhileasvector=Array.prototype.filteroncondition.curry(10);

Array.prototype.suchthatasvector=Array.prototype.filteroncondition.curry(10);

Array.prototype.collectasvector=Array.prototype.suchthatasvector;

Array.prototype.takewhileasvector=Array.prototype.filteroncondition.curry(11);

Array.prototype.dropwhileasvector=Array.prototype.filteroncondition.curry(12);


Array.prototype.splitwhile=Array.prototype.partitiononcondition.curry(0);

Array.prototype.splitwhileasvector=Array.prototype.partitiononcondition.curry(10);

To be documented.