From 6e618918d31464ad719c8cc00ec429d4e9fd719d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorsten=20Wi=C3=9Fmann?= <edu@thorsten-wissmann.de> Date: Thu, 15 May 2014 11:55:38 +0200 Subject: [PATCH] Do not throw all CL coalitions in one bset As ocaml is not purely functional, the following code snippets have different semantics: List.map (List.fold_left tmpf (bsetMakeRealEmpty ())) (List.map S.elements intlist) vs List.map (fun x -> List.fold_left tmpf (bsetMakeRealEmpty ()) x) (List.map S.elements intlist) The former code calls bsetMakeRealEmpty only once, but the latter calls ot for each element of the list returned by the (map ... intlist). Because of this, all coalitions were merged into one big set, i.e. there always was only one coalition: the union of all maximal disjoint sets. This of course triggered bad behaviour, which is fixed now by this commit. The code is unreadable anyway and will be improved a lot by the following commit. This closes #13 --- src/lib/CoAlgLogicUtils.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/CoAlgLogicUtils.ml b/src/lib/CoAlgLogicUtils.ml index 698f7d9..99ab637 100644 --- a/src/lib/CoAlgLogicUtils.ml +++ b/src/lib/CoAlgLogicUtils.ml @@ -94,7 +94,7 @@ let maxDisjoints sort (a: bset) : bset list = let tmpf : bset -> int -> bset = (fun bs f -> bsetAdd bs (lfFromInt f) ; bs) in - List.map (List.fold_left tmpf (bsetMakeRealEmpty ())) + List.map (fun x -> List.fold_left tmpf (bsetMakeRealEmpty ()) x) (List.map S.elements intlist) let string_of_coalition sort bs = -- GitLab