I give error with work prolog SWI-Prolog work ok. Using Node js
const pl = require('tau-prolog');
const session = pl.create();
require("tau-prolog/modules/promises.js")(pl);
require("tau-prolog/modules/lists.js")(pl);
require("tau-prolog/modules/random.js")(pl);
In lists have nth0/3 and nth0/4 but
nth(Board,X,Row):-
write(X),
nth0(X, Board, Row).
const goal = `nth(0,[[1,2,3],[4,5,6]],Row).`;
console.log(goal);
await session.promiseConsult("./backend/ch1.pl");
await session.promiseQuery(goal);
const data = await session.promiseAnswers();
return [await data.next()];
I get error with nth0 , why? HELP Me please.. :( Board is matrix
I trying other nth0 (self) , but not have enought time :(