Did you know ... Search Documentation:
Pack genutils -- prolog/callutils.pl
PublicShow source

Some high-order predicates to enable high-order 'point-free' and lambda free composition of predicates. Also provides a goal expansion for call/N when the target predicate is already known.

 flip(+P:pred(A,B), X:B, Y:A) is det
Call binary predicate P with arguments flipped.
 *(+P:pred(B,C,S,S), +Q:pred(A,B,S,S), X:A, Z:C, S1:S, S2:S) is det
Pure and stateful predicate composition, order may look weird but it follows the usual convention for function composition. Maybe I should flip it round. Calls Q before P.
 *:(+P:pred(A,B,S,S), +G:pred(A,S), X:B, S1:S, S2:S) is det
Stateful piping of generator G into function P. Calls G before P!
 const(X:A, Y:_, Z:A) is det
Unifies X and Z - const(X) is useful as a binary predicate.
 pairf(+F:pred(A,S,S), +G:pred(B,S,S), X:pair(A,B), S1:S, S2:S) is det
Call F and G respectively on components of a pair.
 constf(+F:pred(A,S,S), Y:_, X:A, S1:S, S2:S) is det
Call F on X ignoring argument Y.
 mr(+Mapper:pred(A,B), +Reducer:pred(B,S,S), X:A, S1:S, S2:S) is det
Meet Mr. mr. A map reducer for use with any folding predicate.
 bt_call(:Do, :Undo) is nondet
Creates a backtrackable operation from a non-backtrackable Do operation and a corresponding operation to undo it. Do can be non-deterministic, in which case bt_call(Do,Undo) will also have multiple solutions. Undo is called inside once/1. bt_call is a valid debug topic - you can trace all do and undo operations by issuing debug(bt_call).

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

 *(Arg1, Arg2, Arg3, Arg4)
 true2(Arg1, Arg2)
 fail2(Arg1, Arg2)
 call_with_time_limit(Arg1, Arg2, Arg3, Arg4)
 timeout(Arg1, Arg2, Arg3)
 timeout(Arg1, Arg2, Arg3, Arg4, Arg5)
 timeout_retry(Arg1, Arg2, Arg3, Arg4, Arg5)