Legend:
Library
Module
Module type
Parameter
Class
Class type
LINQ-like operations on collections
The purpose it to provide powerful combinators to express iteration, transformation and combination of collections of items. This module depends on several other modules, including CCList and CCSequence.
Functions and operations are assumed to be referentially transparent, i.e. they should not rely on external side effects, they should not rely on the order of execution.
Abstract type of collections of objects of type 'a. Those cannot be used directly, they are to be processed using a query (type 'at) and converted to some list/sequence/array
group_by f takes a collection c as input, and returns a multimap m such that for each x in c, x occurs in m under the key f x. In other words, f is used to obtain a key from x, and x is added to the multimap using this key.
val reduce :
('a->'b)->('a->'b->'b)->('b->'c)->'acollectiont->'ct
reduce start mix stop q uses start on the first element of q, and combine the result with following elements using mix. The final value is transformed using stop.
join key1 key2 ~merge is a binary operation that takes two collections a and b, projects their elements resp. with key1 and key2, and combine values (x,y) from (a,b) with the same key using merge. If merge returns None, the combination of values is discarded.
Catch errors within the execution itself. In other words, run (catch q) with succeed with x if q succeeds with `Ok x, and fail if q succeeds with `Error s or if q fails