Below is the code we used in class.
In the cslab, it can also be found in /cslab/class/cs243/closures.ml
.
val immediatelyPrecede = [(Reuben, Simeon), (Simeon, Judah), (Judah, Issachar), (Issachar, Zebulun)]; fun transitiveClosure(relation) = if isTransitive(relation) then relation else transitiveClosure(relation @ makeNoRepeats(counterTransitive(relation)))