argmin
It groups the facts of an atom according to certain positions and, for each group, it returns only the facts that minimise a specific position.
The syntax is the following:
@post("atomName", "argmin(p, <p1,..., pn>)").
where atomName
is the atom at hand, p is the position to minimise (from 1) and p1, …, pn
are integers denoting the positions that individuate a specific group.
Example 42
f(1,3,"a", 3).
f(4,3,"a", 5).
f(2,6,"b", 7).
f(2,6,"b", 8).
f(3,6,"b", 9).
@output("g").
@post("g","argmin(4,<2,3>)").
@post("g","orderby(1)").
g(X,Y,Z,K) :- f(X,Y,Z,K).
The expected result is: ` g(1,3,"a",3). g(2,6,"b",7). `