summaryrefslogtreecommitdiff
path: root/inst/prelude.pl
diff options
context:
space:
mode:
authorMirek Kratochvil <exa.exa@gmail.com>2023-03-23 21:51:43 +0100
committerMirek Kratochvil <exa.exa@gmail.com>2023-03-23 21:51:43 +0100
commit17138aabda12645b6dc7f61f080997700738c461 (patch)
tree12416bd43568f9e5d7b49aaedf8224837911a754 /inst/prelude.pl
parent535598bd84e79e92f536a375030d2fac45b881d1 (diff)
downloadprlg-master.tar.gz
prlg-master.tar.bz2
lookahead, sequenceHEADmaster
Diffstat (limited to 'inst/prelude.pl')
-rw-r--r--inst/prelude.pl11
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).