We had this line of discussions many times – and i keep getting back to it as I review my code.
I very much want to stay within Prolog but want the efficiency of C++ pointers for structures that are best represented as directly linked.
I am wondering if its possible to create a new kind of primitive data structure that is optimized for creating truly linked structures (and support for backtracking).
The most primitive could be perhaps be directed_linked(A,B). which is implemented as a true pointer lookup from A to B – but not from B to A. Or bi_directed_linked(A,B), which has pointers in each direction.
If both A and B are unbound, it may not be supported – or this reverts back, somehow, to term lookup.
Does this make sense?
p.s. an extension could be linked(A,B, W), with W an arbitrary primitive or compound term – to associate some value to link.