Format | min(+A, +B, ?Min) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
Calculates the minimum between A and B, or succeeds if the minimum is equal to Min |
Format | lmin(+L, ?Min) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
Calculates the minimum of all numbers given in the list L, or succeeds if the minimum is equal to Min |
Format | max(+A, +B, ?Max) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
Calculates the maximum between A and B, or succeeds if the maximum is equal to Max |
Format | lmax(+L, ?Max) | ||||||
---|---|---|---|---|---|---|---|
Arguments |
| ||||||
Calculates the maximum of all numbers given in the list L, or succeeds if the maximum is equal to Max |
Format | qsort_divide(+List, +Pivot, +CmpPred, +LeftIn, +RightIn, -LeftOut, -RightOut) | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||||||||||||||
sorts elements to the left and right |
Format | qsort(+List, +CmpPred, -Sorted) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
sorts the elements in List according to the comparison prediate with QuickSort |
Format | repeat |
---|---|
succeeds over and over. To be used in backtracking |
Format | while(+P) | |||
---|---|---|---|---|
Arguments |
| |||
succeeds as long as P succeeds.
NOTE: P does NOT backtrack and is NOT bound/unified, e.g.: "?- while(member(E,[1,2])), print(E), fail." will NOT print "1,2", but result in an endless loop where E is always 'bot'! To achieve the intended effect, use 'pforall' instead, e.g., ":- pforall((member(E,[1,2]), print(E)))." 'while' is useful for looping on arrays other predicates that normally only succeed only once, e.g.: ?- set_var(v1,0), while((get_var(v1,$V), $V < 5)), get_var(v1,$V), print($V), increment(v1), fail. (Here please note that since $V is not bound after 'while', the value of the variable has to be fetched again). |
Format | forwhile(Var,L,P) | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
Arguments |
| |||||||||
increments the variable starting from L, as long as the predicate succeeds NOTE: P is NOT bound and does NOT backtrack! See also above under 'while' |