1structure RL_Lib = struct
2
3fun die msg =
4  (TextIO.output(TextIO.stdErr, msg);
5   TextIO.output(TextIO.stdErr, "\n");
6   OS.Process.exit OS.Process.failure)
7
8(* TODO: move? or take from elsewhere? *)
9local open boolLib in
10fun goal_to_string((asl, w):goal) =
11  "[" ^ (String.concatWith "," (List.map term_to_string asl)) ^ "] ?- " ^ (term_to_string w)
12end
13(* -- *)
14
15(* TODO: move to Lib? *)
16fun rotate_list [] = [] | rotate_list (x::xs) = xs @ [x]
17fun unrotate_list ls = Lib.uncurry (Lib.C Lib.cons) (Lib.front_last ls)
18(*
19rotate_list [1,2,3]
20unrotate_list [1,2,3]
21unrotate_list (rotate_list [1,2,3])
22unrotate_list (rotate_list [2])
23*)
24(* -- *)
25
26end
27