From 0738c55c2b1495648d5dc3cbccac4eaa45ea6b1e Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Sat, 13 Apr 2024 13:22:01 +0100 Subject: [PATCH] refactor: move inline marks_set_idx helper Signed-off-by: Rudi Grinberg --- lib/automata.ml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/lib/automata.ml b/lib/automata.ml index d598bddc..eabdf139 100644 --- a/lib/automata.ml +++ b/lib/automata.ml @@ -72,14 +72,12 @@ module Marks = struct let hash m accu = hash_marks_offset m.marks (hash_combine (Hashtbl.hash m.pmarks) accu) - let rec marks_set_idx idx = function - | (a, -1) :: rem -> - (a, idx) :: marks_set_idx idx rem - | marks -> - marks - - let marks_set_idx marks idx = - { marks with marks = marks_set_idx idx marks.marks } + let marks_set_idx = + let rec marks_set_idx idx = function + | (a, -1) :: rem -> (a, idx) :: marks_set_idx idx rem + | marks -> marks + in + fun marks idx -> { marks with marks = marks_set_idx idx marks.marks } let pp_marks ch t = match t.marks with