leonardoalt / SolPrologV2

A Prolog engine written in Solidity.
GNU General Public License v3.0
16 stars 4 forks source link

Equality operator #3

Open cameel opened 4 years ago

cameel commented 4 years ago

We really need an equality operator. In the (tic tac toe demo](https://github.com/leonardoalt/SolPrologV2/tree/master/src/demo) I had to work around it with clauses like these:

same(., .).
same(x, x).
same(o, o).
same([], []).
same([H1|T1], [H2|T2]) :- same(H1, H2), same(T1, T2).

In addition to requiring more code, they're also very heavy to evaluate in the current implementation due to deep nesting. Replacing it with an operator that just does term comparison would speed up the demo a lot.