changeset 2c9153571cee in joypy/Joypy details: http://hg.osdn.jp/view/joypy/Joypy?cmd=changeset;node=2c9153571cee user: Simon Forman <sform****@hushm*****> date: Sun Jul 21 14:13:48 2019 -0700 description: Assert definitions as they are read. Instead of building a list then asserting them all after parsing. diffstat: thun/thun.pl | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-) diffs (24 lines): diff -r e82375b0d716 -r 2c9153571cee thun/thun.pl --- a/thun/thun.pl Sun Jul 21 11:50:27 2019 -0700 +++ b/thun/thun.pl Sun Jul 21 14:13:48 2019 -0700 @@ -186,16 +186,12 @@ joy_def(def(Def, Body)) --> symbol(Def), blanks, "==", joy_parse(Body). -joy_defs([Def|Defs]) --> blanks, joy_def(Def), blanks, joy_defs(Defs). -joy_defs([]) --> []. - -read_defs(DefsFile, Defs) :- - read_file_to_codes(DefsFile, Codes, []), - phrase(joy_defs(Defs), Codes). +joy_defs --> blanks, joy_def(Def), {assert_def(Def)}, blanks, joy_defs. +joy_defs --> []. assert_defs(DefsFile) :- - read_defs(DefsFile, Defs), - forall(member(Def, Defs), assert_def(Def)). + read_file_to_codes(DefsFile, Codes, []), + phrase(joy_defs, Codes). assert_def(def(Def, Body)) :- retractall(def(Def, _)),