diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-23 21:51:43 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2023-03-23 21:51:43 +0100 |
| commit | 17138aabda12645b6dc7f61f080997700738c461 (patch) | |
| tree | 12416bd43568f9e5d7b49aaedf8224837911a754 | |
| parent | 535598bd84e79e92f536a375030d2fac45b881d1 (diff) | |
| download | prlg-master.tar.gz prlg-master.tar.bz2 | |
| -rw-r--r-- | inst/prelude.pl | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/inst/prelude.pl b/inst/prelude.pl index 2bb0b39..afdf306 100644 --- a/inst/prelude.pl +++ b/inst/prelude.pl @@ -57,10 +57,15 @@ lcm(X,Y,R) :- gcd(X,Y,GCD), R is X*(Y/GCD). :- op(1200, xfx, -->). -say([], SameState, SameState) :- !. -say(Tokens, ParsedList, Rest) :- +sequence([], SameState, SameState) :- !. +sequence(Tokens, ParsedList, Rest) :- append(Tokens, Rest, ParsedList). +load_expansion((X, L) --> Y, Xp :- (Yp, Lp)) :- !, + expand_phrasecall(X, Xp, S0, S), + expand_phrase(Y, Yp, S0, S), + expand_phrase(L, Lp, S, _). + load_expansion(X --> Y, Xp :- Yp) :- !, expand_phrasecall(X, Xp, S0, S), expand_phrase(Y, Yp, S0, S). @@ -71,7 +76,7 @@ expand_phrase((A, B), (Ap, Bp), S0, S) :- !, expand_phrase((A; B), (Ap; Bp), S0, S) :- !, expand_phrase(A, Ap, S0, S), expand_phrase(B, Bp, S0, S). -expand_phrase(L, say(L, S0, S), S0, S) :- list(L), !. +expand_phrase(L, sequence(L, S0, S), S0, S) :- list(L), !. expand_phrase({X}, X, S, S) :- !. expand_phrase(!, !, S, S) :- !. expand_phrase(X, Xp, S0, S) :- expand_phrasecall(X, Xp, S0, S). |
