Noeud: All Solutions, Noeud « Next »: , Noeud « Previous »: Internal Database, Noeud « Up »: Built-In Predicates



All Solutions

The predicates described in this section works on the whole set of solutions that may be computed for a goal.

bestof(X,Generator,Y^Test)
Test must denote a total binary relation defined as a guard and is used to compute the best X element for this relation in those generated by Generator. X is unified with this best element.
          %>dyalog -s "?-bestof(X,domain(X,[1,-2,3]),Y^(X<Y)). "
          Answer : X = -2
          

iterate( Iterator, Generator )
Iterator must be either an elementary iterator or a list of elementary iterator. An elementary iterator New^(Init,X^Old^Updater) computes the iterate value of Init by repeated application of Updater to each value X generated by Generator.
          %>dyalog -s "?-iterate(Y^(Y is 0,X^Old^(Y is X+Old)),domain(X,[1,2,3])). "
          Answer : Y = 6
          

Note that iterate doesn't fail if there is no answer Generator but binds New variables to Init values.

group_by(Generator,Grouping,Collector)
Collector of the form New^Current^(Old^Updater,Init) almagates values Current build by Generator

Note that group_by fails if Generator has no answer.