From 92c683a9c4d3e8097a77d2ee73d708035e99250d Mon Sep 17 00:00:00 2001 From: Simon Cruanes Date: Fri, 27 Oct 2017 15:39:01 +0200 Subject: [PATCH] doc: `CCList.cartesian_product` returns results in unspecified order (close #154) --- src/core/CCList.mli | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/CCList.mli b/src/core/CCList.mli index f143de16..bd692957 100644 --- a/src/core/CCList.mli +++ b/src/core/CCList.mli @@ -112,13 +112,15 @@ val fold_product : ('c -> 'a -> 'b -> 'c) -> 'c -> 'a t -> 'b t -> 'c (** Fold on the cartesian product *) val cartesian_product : 'a t t -> 'a t t -(** +(** Produce the cartesian product of this list of lists, + by returning all the ways of picking one element per sublist. + {b NOTE} the order of the returned list is unspecified. For example: {[ - # cartesian_product [[1;2];[3];[4;5;6]] = + # cartesian_product [[1;2];[3];[4;5;6]] |> sort = [[1;3;4];[1;3;5];[1;3;6];[2;3;4];[2;3;5];[2;3;6]];; # cartesian_product [[1;2];[];[4;5;6]] = [];; - # cartesian_product [[1;2];[3];[4];[5];[6]] = + # cartesian_product [[1;2];[3];[4];[5];[6]] |> sort = [[1;3;4;5;6];[2;3;4;5;6]];; ]} invariant: [cartesian_product l = map_product id l].