Multifile func/3.

This commit is contained in:
Simon Forman 2019-08-11 18:45:57 -07:00
parent cd60816429
commit 79aa2f972d
5 changed files with 10 additions and 4 deletions

View File

@ -1,7 +1,8 @@
GPLC_OPTIONS="--min-size"
#GPLC_OPTIONS=--min-size
GPLC_OPTIONS=--no-top-level
thun: thun.pl parser.pl defs.pl main.pl
gplc $(GPLC_OPTIONS) -o thun thun.pl parser.pl defs.pl main.pl
thun: thun.pl parser.pl defs.pl main.pl math.pl Makefile
gplc $(GPLC_OPTIONS) -o thun thun.pl parser.pl defs.pl main.pl math.pl
defs.pl: meta-defs.pl parser.pl defs.txt thun.pl
gprolog \

View File

@ -33,7 +33,9 @@ loop( Line, In, Out) :-
loop(NextLine, S, Out).
do_line(Line, In, Out) :- phrase(joy_parse(E), Line), thun(E, In, Out).
do_line(Line, In, Out) :-
phrase(joy_parse(E), Line),
thun(E, In, Out).
do_line(_Line, S, S) :- write('Err'), nl.
prompt :- write(`joy? `).

View File

@ -1,3 +1,4 @@
:- multifile(func/3).
func(+, [A, B|C], [D|C]) :-
E =.. [+, B, A],
catch(D is E, _, D = E).

View File

@ -61,6 +61,7 @@ writeln(Stream, Thing) :-
do :-
open(`math.pl`, write, Stream),
write(Stream, `:- multifile(func/3).`), nl(Stream),
print_o(Stream, math_operator(Op)),
print_o(Stream, comparison_operator(Op)),
print_o(Stream, comparison_operator(Op, Po)),

View File

@ -19,6 +19,7 @@
*/
% :- dynamic(func/3).
% :- discontiguous(func/3).
:- multifile(func/3).
/*
Interpreter