4 ms·
False is a way to say "this is impossible given the current constraints" It's possible that X could be an integer, but Prolog can't do anything with that, so i
by sesuximo 7y ago
False is a way to say "this is impossible given the current constraints"
It's possible that X could be an integer, but Prolog can't do anything with that, so it just throws an error. I suppose an alternative would be to return 0 and then 1 and then -1 and then 2 etc but I have no idea why anyone would care.
- galaxyLogic 7y agoWouldn't that be the way to generate infinite lists?
- falsissime 7y agoRight, that would be a valid answer too! Unfortunately it has very bad termination properties and is also quite inefficient when larger numbers are involved. And yet, there is a further possibility why not say `when(nonvar(X), integer(X))`. One system tried to go that path: Mu- and Nu-Prolog. However, the practical result was that an erroneous predicate just succeeded and you got an answer with tons of constraints (at that time in that context called floundering goals). A lot of research was put into detecting such flounders, but nothing came out of this effort that is in current use.