+let index_of x =\r
+ let rec aux n =\r
+ function\r
+ [] -> None\r
+ | x'::_ when x == x' -> Some n\r
+ | _::xs -> aux (n+1) xs\r
+ in aux 1\r
+;;\r
+\r
+let sep_of_app =\r
+ let apps = ref [] in\r
+ function\r
+ r when not !r -> " "\r
+ | r ->\r
+ let i =\r
+ match index_of r !apps with\r
+ Some i -> i\r
+ | None ->\r
+ apps := !apps @ [r];\r
+ List.length !apps\r
+ in "," ^ string_of_int i ^ " "\r
+;;\r
+\r