in such a program using library(real):
:- use_module( library(real) ).
:- use_module( library(lists) ).
:- use_module( library(apply_macros) ).
:- use_module( library(readutil) ).
my_sum(L, S):-
i <- L,
<- i,
S <- sum(i).
is there a way to modify the program to be able to run it backwards? Currently, this works:
?- my_sum([1,2,3],X).
X = 6.
But this results in an exception:
?- my_sum(L,2).
ERROR: Arguments are not sufficiently instantiated
ERROR: In:
ERROR: [13] _6776=..[_6782|_6784]
ERROR: [12] real:r_call(_6814,[rvar(i),...|_6832]) at /home/raoul/lib/swipl/pack/real/prolog/real.pl:1101
ERROR: [8] my_sum(_6862++[...|_6870],2) at /home/raoul/Bureau/prolog_relational_stats/relational_R.pl:16
ERROR: [7] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.