Prolog association list

1k views Asked by At

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?

1

There are 1 answers

4
Alexander Serebrenik On BEST ANSWER

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