Skip to content

Commit 2be05fb

Browse files
committed
Extract GobList.cartesian_concat_map
1 parent 287e26b commit 2be05fb

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/cdomain/value/cdomains/int/intervalSetDomain.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ struct
114114
let binop (x: t) (y: t) op : t = match x, y with
115115
| [], _ -> []
116116
| _, [] -> []
117-
| _, _ -> canonize @@ List.concat_map op (BatList.cartesian_product x y)
117+
| _, _ -> canonize @@ GobList.cartesian_concat_map (Batteries.curry op) x y
118118

119119

120120
include Std (struct type nonrec t = t let name = name let top_of = top_of let bot_of = bot_of let show = show let equal = equal end)
@@ -190,7 +190,7 @@ struct
190190
let binary_op_concat_with_norm op (ik:ikind) (x: t) (y: t) : t*overflow_info = match x, y with
191191
| [], _ -> ([],{overflow=false; underflow=false})
192192
| _, [] -> ([],{overflow=false; underflow=false})
193-
| _, _ -> norm_intvs ik @@ List.concat_map (fun (x,y) -> op x y) (BatList.cartesian_product x y) (* TODO: GobList.cartesian_concat_map? *)
193+
| _, _ -> norm_intvs ik @@ GobList.cartesian_concat_map op x y
194194

195195
let binary_op_with_ovc (x: t) (y: t) op : t*overflow_info = match x, y with
196196
| [], _ -> ([],{overflow=false; underflow=false})

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_concat_map f l1 l2 =
62+
List.concat_map (fun x -> List.concat_map (f x) l2) l1
63+
6164

6265
(** Open this to use applicative functor/monad syntax for {!list}. *)
6366
module Syntax =

0 commit comments

Comments
 (0)