diff --git a/README.md b/README.md index 5e9d8a6..349f455 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ G = f(_A, _B), X subsumes _A, Y subsumes _B. -?- f(X, Y) subsumes X. % Example with induced cyclic data. -X = f(X, Y). +?- f(X) subsumes Y, Y subsumes X. % Example with induced cyclic data. +X = Y, Y = f(Y). ?- X subsumes Y, X = g(_). X = g(_A), @@ -18,8 +18,21 @@ Y = g(_B), _A subsumes _B. ``` -See the unit tests in [`prolog/subsumes.plt`](prolog/subsumes.plt) for more examples. +See the unit tests in [`test/subsumes.plt`](test/subsumes.plt) for more examples. + +Executing the following goal from the top-level `subsumes` directory should run all the tests: +```prolog +?- expand_file_name("test/**.plt", Tests), maplist(consult, Tests), run_tests. +``` Note that this conflicts with the deprecated [`terms:subsumes/2`](https://www.swi-prolog.org/pldoc/doc_for?object=subsumes/2). TODO: make ISO-compatible. + +(Note to self) To publish a new version: +1. update `pack.pl` +2. do GitHub release with new tag matching the pack.pl version +3. execute: +```prolog +?- make_directory(potato), pack_install(subsumes, [url('http://github.com/GeoffChurch/subsumes/archive/13.17.zip'), package_directory(potato)]). +``` \ No newline at end of file diff --git a/pack.pl b/pack.pl index c1beba2..87c8379 100644 --- a/pack.pl +++ b/pack.pl @@ -1,5 +1,5 @@ name(subsumes). -version('0.2'). +version('0.3'). title('Relational term subsumption. subsumes/2 is intended as a relational drop-in replacement for subsumes_term/2. Note that this conflicts with the deprecated predicate terms:subsumes/2.'). author('Geoffrey Churchill', 'geoffrey.a.churchill@gmail.com'). home('https://github.com/GeoffChurch/subsumes'). diff --git a/test/subsumes.plt b/test/subsumes.plt index 39d130d..97696ef 100644 --- a/test/subsumes.plt +++ b/test/subsumes.plt @@ -57,8 +57,6 @@ test(subsume_then_unify_leaves_loop) :- % because compact_lbs/1 is called by attribute_goals//1. check_lbs(X, [X]). -:- end_tests(subsumes). - %%% UTILS %%% get_lbs(G, LBs) :- get_attr(G, subsumes, LBs), !. @@ -68,3 +66,5 @@ check_lbs(G, Expected) :- get_lbs(G, Actual), msort(Expected, X), msort(Actual, X). + +:- end_tests(subsumes). diff --git a/test/subsumes_chk.plt b/test/subsumes_chk.plt index a38cde4..24ac453 100644 --- a/test/subsumes_chk.plt +++ b/test/subsumes_chk.plt @@ -30,13 +30,3 @@ test(permavar_subsumes_anything) :- subsumes_chk(X, 3). :- end_tests(subsumes_chk). - -%%% UTILS %%% - -get_lbs(G, LBs) :- get_attr(G, subsumes, LBs), !. -get_lbs(_, []). - -check_lbs(G, Expected) :- - get_lbs(G, Actual), - msort(Expected, X), - msort(Actual, X).