source: code/trunk/lib/string_set.ml@ 2

Last change on this file since 2 was 2, checked in by fox, 3 years ago

Samhain 21

Converter

  • type selection
  • subdir conversion
  • htm extension

Gemini

  • index.gmi
  • topics and latest
  • gmi.atom feed

Add pull (http(s)) operation

  • peers.pub.conf and peers.priv.conf

HTML5 format & fixes by Novaburst
Phony target (thanks Gergely)

May

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.
Logarion created texts have part of the UUID in filename.
Logarion's index re-written in Messagepack format. Removed indices command. They are generated during convert.

File size: 645 bytes
Line 
1include Set.Make(String)
2
3let list_of_csv x = Re.Str.(split (regexp " *, *")) (String.trim x)
4let of_string x = of_list (list_of_csv x)
5let to_string ?(pre="") ?(sep=", ") s =
6 let j a x = match a, x with "", _ -> x | _, "" -> a | _ -> a ^ sep ^ x in
7 fold (fun x acc -> j acc x) s pre
8
9let query string =
10 let partition (include_set, exclude_set) elt =
11 if String.get elt 0 = '!' then (include_set, add String.(sub elt 1 (length elt - 1)) exclude_set)
12 else (add elt include_set, exclude_set) in
13 List.fold_left partition (empty, empty) @@ list_of_csv string
14
15let predicate (inc, exl) set = not (disjoint inc set) && disjoint exl set
Note: See TracBrowser for help on using the repository browser.