in reactor/Core/src/jetbrains/mps/logic/reactor/core/internal/ReteRuleMatcherImpl.kt [585:599]
fun find(): Joint {
if (rep == this) return this
val path = arrayListOf<Joint>()
var p = this
while (p.rep !== p) {
path.add(p)
p = p.rep
}
path.forEach {
it.rep = p
it.prev = it
}
return p
}