Skip to content

Commit 332023d

Browse files
committed
Extract GobList.cartesian_filter_map
1 parent 2be05fb commit 332023d

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/domain/hoareDomain.ml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,8 +368,7 @@ struct
368368
(* TODO: move to Set above? *)
369369
let product_widen (op: elt -> elt -> elt option) a b = (* assumes b to be bigger than a *)
370370
let xs,ys = elements a, elements b in
371-
(* TODO: GobList.cartesian_filter_map? *)
372-
List.concat_map (fun x -> List.filter_map (fun y -> op x y) ys) xs |> fun x -> join b (of_list x)
371+
GobList.cartesian_filter_map op xs ys |> fun x -> join b (of_list x)
373372
let widen = product_widen (fun x y -> if E.leq x y then Some (E.widen x y) else None)
374373

375374
(* above widen is actually extrapolation operator, so define connector-based widening instead *)

src/util/std/gobList.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ let until_last_with (pred: 'a -> bool) (xs: 'a list) =
5858
let cartesian_map f l1 l2 =
5959
List.concat_map (fun x -> List.map (f x) l2) l1
6060

61+
let cartesian_filter_map f l1 l2 =
62+
List.concat_map (fun x -> List.filter_map (f x) l2) l1
63+
6164
let cartesian_concat_map f l1 l2 =
6265
List.concat_map (fun x -> List.concat_map (f x) l2) l1
6366

0 commit comments

Comments
 (0)