[m-dev.] for review: RL bugs
Simon Taylor
stayl at cs.mu.OZ.AU
Tue Jun 15 17:31:44 AEST 1999
I wrote:
> compiler/tree.m:
> Added `tree__tree_of_lists_is_empty', which is similar to
> `tree__is_empty' except that `node([])' is also considered empty.
> +tree__tree_of_lists_is_empty(empty).
> +tree__tree_of_lists_is_empty(node([])).
> +tree__tree_of_lists_is_empty(tree(L, R)) :-
> tree__is_empty(L),
> tree__is_empty(R).
Doing this recursively would probably be a good idea.
Index: tree.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/tree.m,v
retrieving revision 1.11
diff -u -u -r1.11 tree.m
--- tree.m 1998/01/23 12:57:03 1.11
+++ tree.m 1999/06/15 07:27:45
@@ -29,6 +29,9 @@
:- pred tree__is_empty(tree(T)).
:- mode tree__is_empty(in) is semidet.
+:- pred tree__tree_of_lists_is_empty(tree(list(T))).
+:- mode tree__tree_of_lists_is_empty(in) is semidet.
+
%-----------------------------------------------------------------------------%
:- implementation.
@@ -52,5 +55,13 @@
tree__is_empty(tree(L, R)) :-
tree__is_empty(L),
tree__is_empty(R).
+
+%-----------------------------------------------------------------------------%
+
+tree__tree_of_lists_is_empty(empty).
+tree__tree_of_lists_is_empty(node([])).
+tree__tree_of_lists_is_empty(tree(L, R)) :-
+ tree__tree_of_lists_is_empty(L),
+ tree__tree_of_lists_is_empty(R).
%-----------------------------------------------------------------------------%
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list