2 ms·
>does not terminate, as expected okay but generally we want things to terminate. An infinite list of useless solutions is almost never what people want in an a
by Avshalom 3y ago
>does not terminate, as expected
okay but generally we want things to terminate. An infinite list of useless solutions is almost never what people want in an actual program.
which also ties into the definition of "the output variable", which is the information we wanted when we wrote the predicate.
- ngruhn 3y agoI think he's just using it as a test here. He forces infinite backtracking by adding false to the query. You wouldn't do that in an actual program.
- crabbone 3y ago> okay but generally we want things to terminate. Not in this case. In this case the author claims that if there are infinitely many solutions, the predicate should give infinitely many solutions. It's similar to how you want functions in languages that use functions to fail predictably. Eg. you want to receive ENOENT exit code if you try to open a file that doesn't exist. Or, you want to block forever if you join a thread that runs an infinite loop. Do you want to have any of those behaviors in your program? -- rarely, and sometimes not at all. But you want your program to fail in such a way that would indicate that you coded it in a particular way that should result in such an error.