I am running XSB Prolog on my Mac (El Capitan 10.11.2): XSB Version 3.6. (Gazpatcho) of April 22, 2015 [i386-apple-darwin15.2.0 64 bits; mode: optimal; engine: slg-wam; scheduling: local] [Build date: 2016-01-17]
I am using the clpr package and want to write a little meta-interpreter:
:- [clpr].
try((G1,G2)):- !, try(G1), try(G2).
try((G1; G2)):- !, try(G1); try (G2).
try(true):- !.
try({X}):- !, {X}.
try(G):- clause(G, Body), try(Body).
However, try({X=1+2})
does not work -- it does not match the fourth clause, and descends into the fifth clause.
Any idea why?
Hmm, it seems that if a load the file containing the code with
load_dyn(test)
the code works. (It does not work if i just consult the file, i.e. load it with[test]
.