Attempting something similar to example 3.5 in the web prolog book, I have two nodes, A and B. Node A has an 'add/3' rule:
add(X,Y,Z) :- Z is X + Y.
On node B I attempt to spawn and call add:
?- self(Self), spawn((add(10, 20, Z), Self ! Z), Pid, [node('http://localhost:3060'),monitor(true)]),
receive({ M -> format('Result is ~w~n', [M])}).
ERROR: Undefined procedure: add/3 (DWIM could not correct goal)
The error implies that I need an add/3 on node B - if I do add an arbitary add/3 on B then it works, and add/3 on node A is called correctly. Why do I need a definition in B?
If I do this, I don't need a definition in node B:
?- rpc('http://localhost:3060', add(1,2,Z)).
Z = 3
Am I doing something wrong?