Re:Prolog and Logic Programming Historical Sources Archive
by falsissime on Monday March 23, 2020 @11:42AM
(#22665104)
Right, 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.
Re:Prolog and Logic Programming Historical Sources Archive
by galaxyLogic on Monday March 23, 2020 @01:07AM
(#22661406)
Wouldn't that be the way to generate infinite lists?
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.