diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-08-02 23:37:51 -0300 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-08-23 03:06:53 +0000 |
| commit | 8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3 (patch) | |
| tree | 6a673397f921070d8a86d026380548d5e251a29f /lib/concepts/Relation.ml | |
| parent | b762cb41da4d822416c3ab66940622882745fc0a (diff) | |
| download | RNT-8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3.tar.gz RNT-8d59f43f445164e8cc8bd3fe1a23bd04e807a6b3.zip | |
format
Diffstat (limited to 'lib/concepts/Relation.ml')
| -rw-r--r-- | lib/concepts/Relation.ml | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/lib/concepts/Relation.ml b/lib/concepts/Relation.ml index a4fb341..1194804 100644 --- a/lib/concepts/Relation.ml +++ b/lib/concepts/Relation.ml @@ -1,10 +1,6 @@ type address = Hash.hash type schema = string BatMap.String.t - -type t = - { name: string; - tuples: address; - schema: schema } +type t = {name: string; tuples: address; schema: schema} module Field = struct let name = "name" @@ -25,31 +21,27 @@ module Error = struct end let make ~name ~tuples ~schema = {name; tuples; schema} - let name relation = relation.name let tuples relation = relation.tuples let schema relation = relation.schema - let schema_empty = BatMap.String.empty let schema_of_list fields = - List.fold_left (fun acc (name, domain) -> BatMap.String.add name domain acc) schema_empty - fields + List.fold_left (fun acc (name, domain) -> BatMap.String.add name domain acc) schema_empty fields let schema_to_list schema = BatMap.String.bindings schema let schema_to_bencode schema = Codec.Bencode.Dict - (schema_to_list schema - |> List.map (fun (name, domain) -> name, Codec.Bencode.String domain) ) + (schema_to_list schema |> List.map (fun (name, domain) -> name, Codec.Bencode.String domain)) let schema_of_bencode value = let open Utilities.Result in let* fields = Codec.Bencode.as_dict value in fields |> List.map (fun (name, domain) -> - let* domain = Codec.Bencode.as_string domain in - Ok (name, domain) ) + let* domain = Codec.Bencode.as_string domain in + Ok (name, domain) ) |> sequence |> Result.map schema_of_list |
