FluentReduce

fluent_reduce(+Expression, ?Result): reduces a fluent chain of accesses -- as built by the ./2 operator (it.unibo.tuprolog.solve.libs.oop.rules.Dot, e.g. Obj.foo(1).bar parses into the list [Obj, foo(1), bar]) -- down to a single Result, by repeatedly invoking each element of the list as a method on the result of invoking the previous one:

fluent_reduce([P, M | X], R) :- !, invoke_method(P, M, P1), fluent_reduce([P1 | X], R). % recursive
fluent_reduce([P | M], R) :- !, invoke_method(P, M, R). % couple
fluent_reduce(R, R) :- !. % trivial

The trivial clause also covers non-list expressions (e.g. a bare it.unibo.tuprolog.solve.libs.oop.Ref or a $Alias expression, with nothing left to invoke), which simply reduce to themselves.

See also

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Properties

Link copied to clipboard
open override val Scope.body: Term
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val Scope.head: List<Term>
Link copied to clipboard
override val implementation: Rule
Link copied to clipboard

Functions

Link copied to clipboard
override fun toString(): String