The unpac monorepo manager self-hosting as a monorepo using unpac

Cycles: avoid use of Seq

+13
+13
src/cycles.ml
··· 187 187 of an obligatory arc. Use the "unbalanced" heuristic impllemented in 188 188 [takemax] to discriminate between competing possibilities. If a vertex 189 189 is found, remove it from the returned delta bins. *) 190 + (* 190 191 let max_from_deltas g ({ delta_bins; _ } as st) = 191 192 let rec f = function 192 193 | Seq.Nil -> None ··· 196 197 | Some (_, v) -> Some (v, remove_from_bin v st)) 197 198 in 198 199 f (IM.to_rev_seq delta_bins ()) 200 + *) 201 + let max_from_deltas g ({ delta_bins; _ } as st) = 202 + let rec f im = 203 + if IM.is_empty im then 204 + None 205 + else 206 + let k, dbin = IM.max_binding im in 207 + (match VS.fold (takemax g) dbin None with 208 + | None -> f (IM.remove k im) 209 + | Some (_, v) -> Some (v, remove_from_bin v st)) 210 + in 211 + f delta_bins 199 212 200 213 (* Include any leftward arcs due to the two-cycles that were removed by 201 214 preprocessing. *)