wrapIfNeeded

fun wrapIfNeeded(vararg terms: Term, ifEmpty: () -> Term = { Truth.TRUE }): Term

Wraps terms into a single Term: returns ifEmpty's result if terms is empty, the sole element if terms has exactly one, or a Tuple otherwise. Used, in particular, to fold a Clause's body goals into a single Term.


fun wrapIfNeeded(terms: Iterable<Term>, ifEmpty: () -> Term = { Truth.TRUE }): Term
fun wrapIfNeeded(terms: Sequence<Term>, ifEmpty: () -> Term = { Truth.TRUE }): Term

See also