transition to l2
This commit is contained in:
73
README.md
73
README.md
@@ -8,55 +8,70 @@ pure Prolog.
|
||||
|
||||
## Progress
|
||||
|
||||
The language L1 is implemented as a simple REPL. It supports
|
||||
unification on facts and queries without backtracking and rules
|
||||
without clauses, in the familiar Prolog syntax. No data types apart
|
||||
from atoms are currently supported.
|
||||
The language L2 is implemented as a simple REPL. It supports
|
||||
unification on queries without backtracking, where rules and facts are
|
||||
limited to a single name/arity pairing, in the familiar Prolog
|
||||
syntax. No data types apart from atoms are currently supported.
|
||||
|
||||
An example of the level of interaction currently supported is:
|
||||
|
||||
```
|
||||
l1> p(Z, Z).
|
||||
l1> ?- p(Z, Z).
|
||||
l2> p(Z, Z).
|
||||
l2> ?- p(Z, Z).
|
||||
yes
|
||||
l1> ?- p(Z, z).
|
||||
l2> ?- p(Z, z).
|
||||
yes
|
||||
l1> ?- p(Z, w).
|
||||
l2> ?- p(Z, w).
|
||||
yes
|
||||
l1> clouds(are, nice).
|
||||
l1> ?- p(z, w).
|
||||
l2> clouds(are, nice).
|
||||
l2> ?- p(z, w).
|
||||
no
|
||||
l1> ?- p(w, w).
|
||||
l2> ?- p(w, w).
|
||||
yes
|
||||
l1> ?- clouds(Z, Z).
|
||||
l2> ?- clouds(Z, Z).
|
||||
no
|
||||
l1> ?- clouds(Z, W).
|
||||
l2> ?- clouds(Z, W).
|
||||
yes
|
||||
l1> ?- clouds(are, W).
|
||||
l2> ?- clouds(are, W).
|
||||
yes
|
||||
l1> ?- clouds(W, nice).
|
||||
l2> ?- clouds(W, nice).
|
||||
yes
|
||||
l1> ?- clouds(nice, are).
|
||||
l2> ?- clouds(nice, are).
|
||||
no
|
||||
l1> ?- p(Z, h(Z, W), f(W)).
|
||||
l2> ?- p(Z, h(Z, W), f(W)).
|
||||
no
|
||||
l1> p(Z, h(Z, W), f(W)).
|
||||
l1> ?- p(z, h(z, z), f(w)).
|
||||
l2> p(Z, h(Z, W), f(W)).
|
||||
l2> ?- p(z, h(z, z), f(w)).
|
||||
no
|
||||
l1> ?- p(z, h(z, w), f(w)).
|
||||
l2> ?- p(z, h(z, w), f(w)).
|
||||
yes
|
||||
l1> ?- p(Z, h(z, W), f(w)).
|
||||
l2> ?- p(Z, h(z, W), f(w)).
|
||||
yes
|
||||
l1> ?- p(z, h(Z, w), f(w)).
|
||||
l2> ?- p(z, h(Z, w), f(w)).
|
||||
yes
|
||||
l1> ?- p(Z, h(Z, w), f(Z)).
|
||||
l2> ?- p(Z, h(Z, w), f(Z)).
|
||||
yes
|
||||
l1> ?- p(z, h(Z, w), f(Z)).
|
||||
l2> ?- p(z, h(Z, w), f(Z)).
|
||||
no
|
||||
l1> p(f(X), h(Y, f(a)), Y).
|
||||
l1> ?- p(Z, h(Z, W), f(W)).
|
||||
l2> p(f(X), h(Y, f(a)), Y).
|
||||
l2> ?- p(Z, h(Z, W), f(W)).
|
||||
yes
|
||||
l1> quit
|
||||
l2> p(X, Y) :- q(X, Z), r(Z, Y).
|
||||
l2> q(q, s).
|
||||
l2> r(s, t).
|
||||
l2> ?- p(X, Y).
|
||||
yes
|
||||
l2> ?- p(q, t).
|
||||
yes
|
||||
l2> ?- p(t, q).
|
||||
no
|
||||
l2> ?- p(q, T).
|
||||
yes
|
||||
l2> ?- p(Q, t).
|
||||
yes
|
||||
l2> ?- p(t, t).
|
||||
no
|
||||
l2> quit
|
||||
```
|
||||
|
||||
## Occurs check
|
||||
@@ -64,7 +79,7 @@ l1> quit
|
||||
There's no occurs check, so cyclic terms do unify:
|
||||
|
||||
```
|
||||
l1> p(W, W).
|
||||
l1> ?- p(f(f(W)), W).
|
||||
l2> p(W, W).
|
||||
l2> ?- p(f(f(W)), W).
|
||||
yes
|
||||
```
|
||||
Reference in New Issue
Block a user