<commit_before>module StringSet = Set.Make (
  struct
    let compare = Pervasives.compare
    type t = string
  end
)

let string_set_concat (s: StringSet.t list) =
  List.fold_left StringSet.union StringSet.empty s

let string_set_map (f: string -> string) (s: StringSet.t) =
  StringSet.fold (fun x s -> StringSet.add (f x) s) s StringSet.empty

module StringMap = Map.Make(String)

module StringIntSet = Set.Make (
  struct
    let compare = Pervasives.compare
    type t = string * int
  end
)

let string_int_set_concat (s: StringIntSet.t list) =
  List.fold_left StringIntSet.union StringIntSet.empty s

(* An or operator for options *)
let option_either x y =
  match (x, y) with
    | (Some a, _) -> Some a
    | (_, b) -> b

(* A range operator *)
let (--) i j = 
  let rec aux n acc =
    if n < i then acc else aux (n-1) (n :: acc)
  in aux (j-1) []

let rec split_name n =
  try
    let i = (String.index n '.') in
    (String.sub n 0 i) :: (split_name (String.sub n (i+1) ((String.length n)-(i+1))))
  with Not_found -> [n]

(* A general-purpose exception *)
exception Wtf of string

let list_zip a b = List.map2 (fun x y -> (x, y)) a b

let list_zip3 a b c = List.map2 (fun (x, y) z -> (x, y, z)) (list_zip a b) c

(* Sort a list using a partial order *)
let rec partial_sort (lt: 'a -> 'a -> bool option) (l : 'a list) =
  let rec select_smallest before elem after =<commit_msg>Comment on our infix operator:<commit_after>module StringSet = Set.Make (
  struct
    let compare = Pervasives.compare
    type t = string
  end
)

let string_set_concat (s: StringSet.t list) =
  List.fold_left StringSet.union StringSet.empty s

let string_set_map (f: string -> string) (s: StringSet.t) =
  StringSet.fold (fun x s -> StringSet.add (f x) s) s StringSet.empty

module StringMap = Map.Make(String)

module StringIntSet = Set.Make (
  struct
    let compare = Pervasives.compare
    type t = string * int
  end
)

let string_int_set_concat (s: StringIntSet.t list) =
  List.fold_left StringIntSet.union StringIntSet.empty s

(* An or operator for options *)
let option_either x y =
  match (x, y) with
    | (Some a, _) -> Some a
    | (_, b) -> b

(* A range operator - TODO: exclusive, while Batteries equivalent is inclusive *)
let (--) i j = 
  let rec aux n acc =
    if n < i then acc else aux (n-1) (n :: acc)
  in aux (j-1) []

let rec split_name n =
  try
    let i = (String.index n '.') in
    (String.sub n 0 i) :: (split_name (String.sub n (i+1) ((String.length n)-(i+1))))
  with Not_found -> [n]

(* A general-purpose exception *)
exception Wtf of string

let list_zip a b = List.map2 (fun x y -> (x, y)) a b

let list_zip3 a b c = List.map2 (fun (x, y) z -> (x, y, z)) (list_zip a b) c

(* Sort a list using a partial order *)
let rec partial_sort (lt: 'a -> 'a -> bool option) (l : 'a list) =
  let rec select_smallest before elem after =
{'fraction_non_alphanumeric': 0.12849162011173185, 'fraction_numerical': 0.00558659217877095, 'mean_word_length': 2.9902506963788302, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4113055', 'n_tokens_mistral': 1051, 'n_tokens_neox': 1044, 'n_words': 385}