Noeud: All Solutions, Noeud « Next »: Debugging, Noeud « Previous »: Internal Database, Noeud « Up »: Built-In Predicates
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)
%>dyalog -s "?-bestof(X,domain(X,[1,-2,3]),Y^(X<Y)). " Answer : X = -2
iterate(
Iterator,
Generator )
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)
New^
Current^(
Old^
Updater,
Init)
almagates values Current build by Generator
Note that group_by fails if Generator has no answer.