From bb3156b8ab78b035ce886bbe3021ec7cbe269d03 Mon Sep 17 00:00:00 2001 From: Marcos Magueta Date: Sat, 11 Jul 2026 00:51:11 -0300 Subject: FOL: First Order Logic Execution Engine Co-authored-by: Estevan Castilho --- lib/concepts/Path.ml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 lib/concepts/Path.ml (limited to 'lib/concepts/Path.ml') diff --git a/lib/concepts/Path.ml b/lib/concepts/Path.ml new file mode 100644 index 0000000..c751301 --- /dev/null +++ b/lib/concepts/Path.ml @@ -0,0 +1,16 @@ +type t = string BatFingerTree.t + +let empty : t = BatFingerTree.empty +let of_list (components : string list) : t = BatFingerTree.of_list components +let to_list (path : t) : string list = BatFingerTree.to_list path +let snoc (path : t) (component : string) : t = BatFingerTree.snoc path component +let to_string (path : t) : string = String.concat "/" (to_list path) + +let is_prefix ~(prefix : t) (path : t) : bool = + let rec walk prefix path = + match prefix, path with + | [], _ -> true + | p :: prefix, x :: path -> p = x && walk prefix path + | _ :: _, [] -> false + in + walk (to_list prefix) (to_list path) -- cgit v1.2.3