This answer by Jan Burse shows one of the simplest implementations of a metainterpreter in Prolog:
solve(true) :- !.
solve((A,B)) :- !, solve(A), solve(B).
solve(H) :- clause(H,B), solve(B).
I would like to extend this interpreter so that it can call builtins. The vanilla one isn't able to handle calls such as solve(member(X, [1,2,3,4]))
. Is this possible using ISO predicates? If not, is it possible using SWI-Prolog predicates?
Stackoverflow is refusing to accept my answer :) that was
Just call/1 them
Edit
For instance
The only addition:
solve(T) :- call(T)
.