aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Scope.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-10-24 03:35:20 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-10-24 03:51:08 +0000
commit8c2f0db7337328570af57461a3d95203537ac185 (patch)
treedf90400d4719ab5c04fb84530a8a3c0e2eae213e /lib/kernel/Scope.ml
parentdf6c0744dc4ebd164cd8a309eef5d2798b2d3e90 (diff)
downloadRNT-8c2f0db7337328570af57461a3d95203537ac185.tar.gz
RNT-8c2f0db7337328570af57461a3d95203537ac185.zip
Use finger trees in more places
Diffstat (limited to 'lib/kernel/Scope.ml')
-rw-r--r--lib/kernel/Scope.ml12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/kernel/Scope.ml b/lib/kernel/Scope.ml
index cd82b26..ba9c1e0 100644
--- a/lib/kernel/Scope.ml
+++ b/lib/kernel/Scope.ml
@@ -44,20 +44,20 @@ let attribute home relation text =
(* every relation of a branch state, as multigroup:schema:relation *)
let catalog_of branch =
let open Utilities.Result in
- let name prefix last = String.concat ":" (List.rev (last :: prefix)) in
+ let name prefix last = Utilities.FingerTree.join (BatFingerTree.reverse (BatFingerTree.cons prefix last)) ":" in
let rec down prefix handle properties =
let* level = Path.find handle Path.(List.hd properties @/ this) in
match level, List.tl properties with
- | None, _ -> Ok []
+ | None, _ -> Ok BatFingerTree.empty
| Some level, [] ->
let* listing = Protocols.Handle.require Protocols.Directory.from level in
let* names = Protocols.Directory.list listing in
- Ok (List.map (name prefix) (BatFingerTree.to_list names))
+ Ok (BatFingerTree.map (name prefix) names)
| Some level, rest ->
let* named = Protocols.Directory.children level in
- Utilities.List.concat_map (fun (n, child) -> down (n :: prefix) child rest) named
+ Utilities.FingerTree.concat_mapm (fun (n, child) -> down (BatFingerTree.cons prefix n) child rest) named
in
- down [] branch ["multigroup"; "schema"; "relation"]
+ down BatFingerTree.empty branch ["multigroup"; "schema"; "relation"]
let rec make branch home =
Prototype.mixture
@@ -88,7 +88,7 @@ let rec make branch home =
let* previous = Path.find branch Path.("previous" @/ this) in
Ok (Option.map (fun p -> make p home) previous)
- method catalog = catalog_of branch
+ method catalog = catalog_of branch |> Result.map BatFingerTree.to_list (* FIXME: use finger trees thoroughly *)
end ]
let heads = Path.("system" @/ "branch" @/ this)