Implementing partial evaluation in SWI-Prolog
问题 I'm writing a partial-evaluator for Prolog queries. I tried to expand a query using expand_goal/2, but it simply unifies the Input with the Output in this case: :- initialization(main). main :- Input=is_between(1,A,3),expand_goal(Input,Output),writeln(Output). is_between(A,B,C) :- B>A,B<C. I also tried using term_expansion/2, but this causes the program to fail: :- initialization(main). main :- Input=is_between(1,A,3),term_expansion(Input,Output),writeln(Output). is_between(A,B,C) :- B>A,B<C.