Replies: 5 comments 6 replies
-
IMO determinism is dependent on the mode in which predicate is used, so it might all be true: |
Beta Was this translation helpful? Give feedback.
-
Is there a standard convention to mark non-terminating predicates? For example that will give couple of answer and then will loop forever. |
Beta Was this translation helpful? Give feedback.
-
Also, number of answers and choice points depends on selected evaluation strategy, for example enabling tabling may improve determinism of a given predicate... |
Beta Was this translation helpful? Give feedback.
-
All these specifiers come from Mercury and are highly procedural leading to code such as the one you mention. There is not even an attempt to state under what conditions the predicate has a declarative meaning. There are somewhat related declarative properties, like functional dependency. So far rather unbeknownst to Prolog. |
Beta Was this translation helpful? Give feedback.
-
I was writing some code recently and it just occurred to me. Is it a sane idea to document the class of a relation? %% length(List, Integer) is bijection.
%
length([], 0).
length([_|T], N) :- ... . UPDT: |
Beta Was this translation helpful? Give feedback.
-
The Further Reading on this page of @triska's The Power of Prolog mentions Coding Guidelines for Prolog by Covington &al, from which I reproduce the following:
det
Must succeed exactly once and leave no choice-points.semidet
Must either fail or succeed exactly once and leave no choice-points.multi
Must succeed at least once but may leave choice-points on the last success.nondet
May either fail or succeed any number of times and may leave choice-points on last success.These are to be used in documentation headers such as,
Questions:
multi
predicate?My basic hope is that, by adopting a highly evolved documentation convention I might force myself deliberately and consistently to consider the most important properties of each predicate I write.
Beta Was this translation helpful? Give feedback.
All reactions