Legend:
Library
Module
Module type
Parameter
Class
Class type
LINQ-like operations on collections
The purpose is 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.
Remove duplicate elements from the input collection. All elements in the result are distinct.
Aggregation
val group_by :
?cmp:'bord->?eq:'bequal->?hash:'bhash->('a->'b)->'at->('b, 'a list)PMap.tt
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 group_by' :
?cmp:'bord->?eq:'bequal->?hash:'bhash->('a->'b)->'at->('b * 'a list)t
val reduce : ('a->'b)->('a->'b->'b)->('b->'c)->'at->'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.
val join :
?cmp:'keyord->?eq:'keyequal->?hash:'keyhash->('a->'key)->('b->'key)->merge:('key->'a->'b->'c option)->'at->'bt->'ct
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.
val group_join :
?cmp:'aord->?eq:'aequal->?hash:'ahash->('b->'a)->'at->'bt->('a, 'b list)PMap.tt
group_join key2 associates to every element x of the first collection, all the elements y of the second collection such that eq x (key y)