guregu / trealla-js

Trealla Prolog for the web
MIT License
42 stars 1 forks source link

Sometimes there is no answer #16

Closed triska closed 2 years ago

triska commented 2 years ago

For example, when I query:

?- length(Ls, L).

I get no answer at all.

Note that many interesting programs have infinitely—or very many—solutions, as is the case in many combinatorial tasks.

guregu commented 2 years ago

Currently the playground naively loops through the results, possibly blocking forever on infinite queries. Adding some buttons to control the iteration like SWISH should solve this problem. We can support this now that https://github.com/trealla-prolog/trealla/issues/46 is implemented.

guregu commented 2 years ago

I added a simple query iterator kind of like SWISH's. I'll make it look nicer and add some hotkeys later. As an extremely simple failsafe, pressing "all" will pause after 10000 results (returning control to the user, but not killing the query). Should probably make this a timer instead.