714 |
714 |
715 fun swi_prolog_query_firstn n (rel, args) vnames = |
715 fun swi_prolog_query_firstn n (rel, args) vnames = |
716 "eval :- findnsols(" ^ string_of_int n ^ ", (" ^ space_implode ", " vnames ^ "), " ^ |
716 "eval :- findnsols(" ^ string_of_int n ^ ", (" ^ space_implode ", " vnames ^ "), " ^ |
717 rel ^ "(" ^ space_implode ", " (map write_term args) ^ "), Sols), writelist(Sols).\n" ^ |
717 rel ^ "(" ^ space_implode ", " (map write_term args) ^ "), Sols), writelist(Sols).\n" ^ |
718 "writelist([]).\n" ^ |
718 "writelist([]).\n" ^ |
719 "writelist([(" ^ space_implode ", " vnames ^ ")|T]) :- " ^ |
719 "writelist([(" ^ space_implode ", " vnames ^ ")|SolutionTail]) :- " ^ |
720 "writef('" ^ space_implode ";" (map (fn v => v ^ " = %w") vnames) ^ |
720 "writef('" ^ space_implode ";" (map (fn v => v ^ " = %w") vnames) ^ |
721 "\\n', [" ^ space_implode ", " vnames ^ "]), writelist(T).\n" |
721 "\\n', [" ^ space_implode ", " vnames ^ "]), writelist(SolutionTail).\n" |
722 |
722 |
723 val swi_prolog_prelude = |
723 val swi_prolog_prelude = |
724 "#!/usr/bin/swipl -q -t main -f\n\n" ^ |
724 "#!/usr/bin/swipl -q -t main -f\n\n" ^ |
725 ":- use_module(library('dialect/ciao/aggregates')).\n" ^ |
725 ":- use_module(library('dialect/ciao/aggregates')).\n" ^ |
726 ":- style_check(-singleton).\n" ^ |
726 ":- style_check(-singleton).\n" ^ |