logarion-2021/lib/string_set.ml
orbifx 6c27c7c6fb Draft
Basic unit renamed from Note to Text.

New modular text-parser, internal to Logarion, for generic notation parsing. The default input format is now a much plainer text.

Eliminated Meta module and generally lib/ modules.

New Store interface, with additional information from Store. For example the converter can now check filesystem dates. Changed to filesystem hardlinks for tracking publications & indexing, instead of categories. New commands `publish [-i]` and `deindex [-u]`. Categories are ignored now.

Logarion created texts have part of the UUID instead of a counter in their filename. New -i, --interactive flag for interactive creation & publication.

Logarion's index re-written in Messagepack format. Removed `indices` command. They are generated during `convert`.
2021-03-31 19:14:58 +01:00

16 lines
645 B
OCaml

include Set.Make(String)
let list_of_csv x = Re.Str.(split (regexp " *, *")) (String.trim x)
let of_string x = of_list (list_of_csv x)
let to_string ?(pre="") ?(sep=", ") s =
let j a x = match a, x with "", _ -> x | _, "" -> a | _ -> a ^ sep ^ x in
fold (fun x acc -> j acc x) s pre
let query string =
let partition (include_set, exclude_set) elt =
if String.get elt 0 = '!' then (include_set, add String.(sub elt 1 (length elt - 1)) exclude_set)
else (add elt include_set, exclude_set) in
List.fold_left partition (empty, empty) @@ list_of_csv string
let predicate (inc, exl) set = not (disjoint inc set) && disjoint exl set