Commit Graph

2776 Commits

Author SHA1 Message Date
Euan Lacy
aaa75c3ffc wip: basic completion of predicates 2022-05-10 18:10:18 +01:00
Mark Thom
2dfa108034 unify partial string tail later in create_partial_string (#1462, #1465, #1427) 2022-05-08 14:52:22 -06:00
Mark Thom
4895cb7b22 fix culprit in stream_position permission_error (#1463) 2022-05-06 17:38:25 -06:00
Mark Thom
2d3eb8483f correct cycle detection in unify_* (#1455) 2022-05-05 18:58:56 -06:00
Mark Thom
36ef988514 Merge pull request #1461 from triska/clpz_sign
ADDED: sign/1
2022-05-05 17:24:54 -06:00
Markus Triska
d58dd7cc91 ADDED: sign/1 2022-05-05 22:51:49 +02:00
Markus Triska
7e06abebd5 remove comment that seems no longer valid 2022-05-05 22:51:49 +02:00
Mark Thom
8dd7f51ae3 fix rnd_i fixnum casting bug (#1456, #1458) 2022-05-04 22:44:12 -06:00
Mark Thom
6030fae685 track f64 offsets in Literal (#1190) 2022-05-04 21:54:46 -06:00
Mark Thom
0f502fff84 compact lists of characters to partial strings in read_term_from_heap (#1452, #1453) 2022-05-03 19:12:16 -06:00
Mark Thom
789f662ec8 fix match_partial_string, compare_pstr_to_string (#1451) 2022-04-30 19:51:19 -06:00
Mark Thom
72536037ca remove redundant register assignments in numeric comparisons (#1438, #1448) 2022-04-29 09:16:22 -06:00
Mark Thom
e4eefc92f4 remove redundant skip_stub_try_me_else condition (#1444) 2022-04-29 09:16:22 -06:00
Mark Thom
23c4e935b4 Merge pull request #1436 from triska/must_be_term
ADDED: can_be(term, ...) and must_be(term, ...)
2022-04-26 13:31:43 -06:00
Mark Thom
68b4951bc9 replace SliceDeque with VecDeque 2022-04-25 22:55:28 -06:00
Mark Thom
ed89c43e48 catch existence_error exceptions from top-level calls to attribute_goals/3 (#1432) 2022-04-24 20:59:00 -06:00
Mark Thom
16137ace0e unify structures from left to right (#1396) 2022-04-22 19:00:42 -06:00
Mark Thom
b4ef7556da update to crossterm 0.20.0 (#1439) 2022-04-21 18:41:07 -06:00
Markus Triska
eea83d9474 ADDED: can_be(term, ...) and must_be(term, ...)
This terminology is a bit harder to understand than that of the other
type checks.

Scryer Prolog comprises two individually consistent but incompatible
notions of terms, namely terms and rational trees (which are also
called "cyclic terms"). This leads to a confusion in terminology,
because cyclic terms are not terms in the former sense even though
they also contain the word "term" in their name.

This terminological confusion is not restricted to terms: We also find
it for example in the notion of lists. Lists are defined inductively:

    - The empty list (written as "" or [], called 'nil') is a list.
    - A term with principal functor '.'/2 is a list if its second argument
      is a list.

Note that a list may contain cyclic terms as elements, and still be
called a list. However, if we post:

    ?- Ls = [_|Ls].

then Ls is not a list, because it does not fit the inductive
definition. Still, it is sometimes referred to as a "cyclic list" or
"circular list", even though it is not a list. Even Prolog
implementors that aim for strict conformance to the Prolog ISO
standard and are deeply familiar with the standard use this
terminology when talking about such terms, see for example:

    https://github.com/ichiban/prolog/pull/198

Consequently, must_be(list, Ls) raises a *type error* in this case.

Terms are distinguished from cyclic terms completely analogously. This
leads to the counterintuitive consequence that *cyclic lists are not
terms*. The reason for this apparent contradiction in terminology is
the mutual incompatibility of different notions of terms. The notion
of "term" precludes rational trees, similar to the notion of "list"
which precludes cyclic lists.

We therefore introduce:

    * must_be(term, Term)
      - raises an instantiation error if Term contains variables (since
        it could still become a rational tree)
      - raises a type error if Term is a rational tree

    * can_be(term, Term)
      - raises a type error if Term is a rational tree

Note that using the notion of "cyclic term" and "acyclic term" in this
terminology would not be a good idea, because this confusion is
precisely what we want to eliminate: must_be(term, Term) should be
usable as a test that reliably determines whether Term can be treated
as a term with the logical properties we expect from terms.

This addresses #1428.
2022-04-20 22:15:32 +02:00
Mark Thom
9d5264c5a3 very minor optimizations 2022-04-17 20:10:13 -06:00
Mark Thom
66075bf45b mark unsafe variables and substitute temporary variables in is/2 when appropriate (#1430) 2022-04-17 17:33:09 -06:00
Mark Thom
35b8f69f92 fix panic caused by jmp offset off by one error (#1429) 2022-04-17 12:22:34 -06:00
Mark Thom
2d5fe21b05 avoid writing chars to the atom table in several places 2022-04-17 12:20:00 -06:00
Mark Thom
b448681872 Merge pull request #1421 from gruhn/master
push Docker image on new release
2022-04-16 11:11:33 -06:00
Mark Thom
05c14d5780 fix comparisons to partial string tails (#1420) 2022-04-14 22:14:23 -06:00
Niklas Gruhn
bb9de52a53 push Docker image on new release
Setup GitHub action which automatically builds and pushes Docker
images, when new release tags are created.
2022-04-14 21:42:28 +02:00
Mark Thom
7595ec16e5 instantiate Module in definition of retract/1 (#1392) 2022-04-13 20:31:16 -06:00
Mark Thom
d8cf0f320d mark cells that are about to be iterated in the stackful iterator (#1418) 2022-04-12 22:51:20 -06:00
Mark Thom
d644a3996e use '$call' all throughout setup_call_cleanup/3 2022-04-12 17:27:48 -06:00
Mark Thom
525050c407 dereference head of list in is_continuable (#1417) 2022-04-11 17:01:47 -06:00
Mark Thom
468088fd6b stop detecting cycles in compare_pstr_to_string 2022-04-10 19:46:34 -06:00
Mark Thom
95c192a988 mark variable referents in stackful iterator, fix tests (#1408) 2022-04-10 14:17:47 -06:00
Mark Thom
d6287fae06 Merge pull request #1415 from wkral/set_output-error
Fix reported source for set_output/1 error (#1407)
2022-04-10 14:11:43 -06:00
William Kral
9e98f75495 Fix reported source for set_output/1 error (#1407) 2022-04-10 12:00:59 -07:00
Mark Thom
56681af1b6 print dot after errors, fix tests (#1408) 2022-04-10 10:15:00 -06:00
Mark Thom
8bf3d4ea71 fix tests, use '$first_answer' to print indentation before errors (#1408) 2022-04-09 20:32:52 -06:00
Mark Thom
00eab4d415 print errors as goals (#1408) 2022-04-09 14:01:48 -06:00
Mark Thom
0876d46880 unmark dereferenced cells in term_variables/2 (#1412) 2022-04-09 12:15:46 -06:00
Mark Thom
ed803d30cd dereference bindings returned by stackful iterator (#1410, #1411) 2022-04-09 11:47:54 -06:00
Mark Thom
b6504bf377 deduplicate variable list in term_variables/2 (#1409) 2022-04-08 21:18:59 -06:00
Mark Thom
85b4f235ef throw errors on cyclic terms when evaluating is/2 expressions 2022-04-07 23:06:58 -06:00
Mark Thom
064bfa5e0d fix loop in stackful iterator (#1405, #1384) 2022-04-07 20:48:40 -06:00
Mark Thom
4a6ffb6b9e detect immediately cyclic lists (#1384) 2022-04-06 22:53:48 -06:00
Mark Thom
d952b7ace8 restore correct order to term_variables/2 (#1400, #1401) 2022-04-06 08:39:16 -06:00
Mark Thom
3b6138eaaa limit use of stackless iterator to test suite 2022-04-05 21:02:39 -06:00
Mark Thom
f3167f6b5f add forwarding bit to all heap cells (#1384) 2022-04-05 20:34:27 -06:00
Mark Thom
8c99d748e2 allocate floats in dedicated buffer 2022-04-05 20:34:27 -06:00
Mark Thom
0ab928063e make marker into an iterators, recover post_order_iterator 2022-04-05 20:34:27 -06:00
Mark Thom
c9a34bde3f removal of old stackless iterator, implementation of new more faithful one 2022-04-05 20:34:27 -06:00
Mark Thom
7f85c682b8 Merge pull request #1395 from wkral/fix-test-indentation
Fix indentation before false in tests (#676)
2022-04-05 10:58:12 -06:00