Question

I am writing a simple program safety checker in Prolog and I need a data structure to hold variable valuation. Since I want to detect when I am visiting same state again, this structure must support some reasonable comparison semantics, so I can store visited states in set.

library(avl) has convenient getter/setter interface. The problem is, AVL holding the same mapping can take multiple forms. Thus two identical states would be considered distinct if their AVL representation differs.

A structure holding mapping in ordered lists would be free of this problem. However, I can't find anything like that in Sicstus docs. Is there any standard structure that does what I need, or do I have to implement it myself?

Était-ce utile?

La solution

You have ordered sets but in AVL you can always convert AVLs to ordered lists of key-valued pairs and then compare them.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top