Skip to content

Commit

Permalink
Removing useless function
Browse files Browse the repository at this point in the history
The function `partition_map` was only used by the case splits dispatcher
of `Relation.ml`. We don't need this function anymore after refactoring
this dispatcher.
  • Loading branch information
Halbaroth committed Oct 6, 2023
1 parent 44bf32a commit 43ebd6b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
15 changes: 0 additions & 15 deletions src/lib/util/lists.ml
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,3 @@ let rec equal eq l1 l2 =
| [], [] -> true
| hd1 :: tl1, hd2 :: tl2 when eq hd1 hd2 -> equal eq tl1 tl2
| _ -> false

let partition_map ?(keep_ordering=true) f l =
let rec part left right = function
| [] ->
if keep_ordering then List.rev left, List.rev right
else left, right
| x :: l ->
let left, right =
match f x with
| Ok x -> x :: left, right
| Error x -> left, x :: right
in
part left right l
in
part [] [] l
8 changes: 0 additions & 8 deletions src/lib/util/lists.mli
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,3 @@ val equal : ('a -> 'a -> bool) -> 'a list -> 'a list -> bool
respectively, we have [eq ai bi].
This is a backport of List.equal from OCaml 4.12.0 *)

val partition_map :
?keep_ordering:bool ->
('a -> ('b, 'c) result) -> 'a list -> 'b list * 'c list
(** Similar to List.partition, but also applies a map on the elements
of the resulting lists on the fly. Ordering of elements will not be
kept if [keep_ordering] is unset (Default value is [keep_ordering =
true]), in which case, resulting lists are reverted *)

0 comments on commit 43ebd6b

Please sign in to comment.