Compiler support for cyclic terms?

Built-in, there is no hurry. You can quite easily check for a cyclic term though and call term_factorized/3 to create a non-cyclic version and stick the cycle unification at the start of the body. We could implement this in assert as a way to handle the exception, i.e. opportunistically assume the term is acyclic and do plan B otherwise.

Looks like the toplevel can’t deal with cyclic queries. As read_term/2 cannot produce these normally that doesn’t matter too much. A couple of things need to be fixed though. You’ll probably encounter similar problems for goal expansion. Pull requests welcome :slight_smile: