Did you know ... Search Documentation:
Pack ccprism -- prolog/machines.pl
PublicShow source
 :>(+P:pred(-A), +Q:pred(+A,-B), -Y:B) is det
machine composition: generator :> transducer --> generator
 unfolder(+T:pred(-X,+S,-S), S0:S, -G:unfolder(X,S)) is det
 mapper(+F:pred(+X,-Y), +G:unfolder(X,S), -T:unfolder(Y,S)) is det
 moore(+T:pred(+X,+SB,-SB), +O:pred(+SB,-Y), S0:SB, +G:unfolder(X,SA), -G2:unfolder(Y,pair(SA-SB))) is det
 iterator(+I:pred(-pred(-X,+S,-S)), S0:S, -G:unfolder(pair(X,S),S)) is det

Re-exported predicates

The following predicates are re-exported from other modules

 foreach(:Generator, :Goal)
True if conjunction of results is true. Unlike forall/2, which runs a failure-driven loop that proves Goal for each solution of Generator, foreach/2 creates a conjunction. Each member of the conjunction is a copy of Goal, where the variables it shares with Generator are filled with the values from the corresponding solution.

The implementation executes forall/2 if Goal does not contain any variables that are not shared with Generator.

Here is an example:

?- foreach(between(1,4,X), dif(X,Y)), Y = 5.
Y = 5.
?- foreach(between(1,4,X), dif(X,Y)), Y = 3.
false.
bug
- Goal is copied repeatedly, which may cause problems if attributed variables are involved.
 +Parameters >> +Lambda
 >>(+Parameters, +Lambda, ?A1)
 >>(+Parameters, +Lambda, ?A1, ?A2)
 >>(+Parameters, +Lambda, ?A1, ?A2, ?A3)
 >>(+Parameters, +Lambda, ?A1, ?A2, ?A3, ?A4)
 >>(+Parameters, +Lambda, ?A1, ?A2, ?A3, ?A4, ?A5)
 >>(+Parameters, +Lambda, ?A1, ?A2, ?A3, ?A4, ?A5, ?A6)
 >>(+Parameters, +Lambda, ?A1, ?A2, ?A3, ?A4, ?A5, ?A6, ?A7)
Calls a copy of Lambda. This is similar to call(Lambda,A1,...), but arguments are reordered according to the list Parameters:
  • The first length(Parameters) arguments from A1, ... are unified with (a copy of) Parameters, which may share them with variables in Lambda.
  • Possible excess arguments are passed by position.
Arguments:
Parameters- is either a plain list of parameters or a term {Free}/List. Free represents variables that are shared between the context and the Lambda term. This is needed for compiling Lambda expressions.

Undocumented predicates

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

 iterate(Arg1, Arg2, Arg3, Arg4)
 unfold(Arg1, Arg2)
 unfold_finite(Arg1, Arg2)
 cofold(Arg1, Arg2, Arg3)
 scanner(Arg1, Arg2, Arg3)
 scan0(Arg1, Arg2, Arg3, Arg4)
 drop(Arg1, Arg2, Arg3)
 mean(Arg1, Arg2)
 mean(Arg1, Arg2, Arg3, Arg4, Arg5)
 subsample(Arg1, Arg2, Arg3)