[m-rev.] diff: fixes for trailed_update tests
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Nov 5 17:58:43 AEDT 2002
Branches: main
Estimated hours taken: 3
Fix some problems with the trailed_update tests.
extras/trailed_update/var.m:
Document that this module doesn't work in `.rt' grades (and why).
extras/trailed_update/samples/Mmakefile:
Disable the vqueens test in `.rt' grades.
Also, enable the interpreter test, since the reason for disabling
it is no longer valid now that the value numbering pass has been
deleted.
Also, use $(DIFF_OPTS) rather than hard-coding "-c".
extras/trailed_update/samples/interpreter.exp:
Update to reflect the current output,
which has different variable numbers than the original output.
(The output also changed slightly when interpreter.m was changed
to use store__new rather than store__init.)
Workspace: /home/ceres/fjh/ws-ceres2/mercury
Index: extras/trailed_update/var.m
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/var.m,v
retrieving revision 1.20
diff -u -d -r1.20 var.m
--- extras/trailed_update/var.m 27 Oct 2002 13:46:54 -0000 1.20
+++ extras/trailed_update/var.m 5 Nov 2002 06:31:37 -0000
@@ -24,6 +24,10 @@
% for cyclic terms; if you attempt to do anything much with cyclic terms,
% your program will probably not terminate.
%
+% NOTE: The current implementation of this module makes some assumptions
+% about the representation of Mercury terms which mean that it does not work
+% in ".rt" (--reserve-tag) grades.
+%
%-----------------------------------------------------------------------------%
:- module var.
:- interface.
@@ -151,6 +155,11 @@
%
% PLEASE DO NOT IMITATE THIS CODING STYLE!
%
+% Note that the way we use setarg assumes that the alias/1 functor of the
+% var_rep/1 type is represented using only a primary tag, not a secondary tag.
+% This assumption is false for .rt (--reserve-tag) grades, so this module
+% doesn't work in .rt grades.
+%
%---------------------------------------------------------------------------%
% We use '$VAR'/1 as the name for the functor for variable
@@ -899,6 +908,10 @@
** WARNING: setarg/3 uses side-effects and is not type-safe!
** Also it does not work for types with exactly one
** functor that has exactly one arg.
+** Also for types which are represented with a secondary tag
+** (e.g. types with more than four functors, or more than three
+** functors with --reserve-tag) it modifies the (N-1)th argument
+** rather than the Nth argument.
** It may not work with future release of the Mercury compiler,
** or with other Mercury implementations.
** Use only with great care!
Index: extras/trailed_update/samples/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/samples/Mmakefile,v
retrieving revision 1.14
diff -u -d -r1.14 Mmakefile
--- extras/trailed_update/samples/Mmakefile 18 May 2001 14:23:52 -0000 1.14
+++ extras/trailed_update/samples/Mmakefile 5 Nov 2002 06:34:04 -0000
@@ -31,7 +31,14 @@
#-----------------------------------------------------------------------------#
+# The "vqueens" program does not work in ".rt" grades,
+# since it uses the "var" module which does not work in ".rt" grades.
+ifeq "$(findstring .rt,$(GRADE))" ".rt"
+PROGS = interpreter
+else
PROGS = interpreter vqueens
+endif
+
DEPENDS = $(PROGS:%=%.depend)
CS = $(PROGS:%=%.c)
@@ -44,8 +51,10 @@
%.out: %
./$< > $@ 2>&1;
+DIFF_OPTS=-c
+
%.res: %.exp %.out
- diff -c $*.exp $*.out > $@
+ diff $(DIFF_OPTS) $*.exp $*.out > $@
#-----------------------------------------------------------------------------#
@@ -61,12 +70,7 @@
all: $(PROGS)
.PHONY: check
-# XXX the test of `interpreter' is disabled,
-# since it fails in grade asm_fast.tr.
-# (It fails due to a bug in value numbering which causes
-# parts of the Mercury library to be miscompiled.)
-check: vqueens.res
-# check: $(RESS)
+check: $(RESS)
.PHONY: cs
cs: $(CS)
Index: extras/trailed_update/samples/interpreter.exp
===================================================================
RCS file: /home/mercury1/repository/mercury/extras/trailed_update/samples/interpreter.exp,v
retrieving revision 1.2
diff -u -d -r1.2 interpreter.exp
--- extras/trailed_update/samples/interpreter.exp 15 Feb 1998 06:23:47 -0000 1.2
+++ extras/trailed_update/samples/interpreter.exp 5 Nov 2002 06:48:16 -0000
@@ -19,7 +19,7 @@
:- import_module store, tr_store, map, multi_map.
:- import_module list, string, term, varset, term_io, require, std_util.
:- import_module io.
-:- impure pred write_solution(varset, map(var, my_var(_0)), my_term(_0), store(_0)).
+:- impure pred write_solution(varset, map(var, my_var(_2)), my_term(_2), store(_2)).
:- mode database_lookup_pred_clause(in, in, out) is nondet.
:- mode database_lookup_clause(in, in, out) is nondet.
:- mode database_lookup_clause(in, in, out, out, out) is nondet.
@@ -50,90 +50,90 @@
:- mode main_loop_2(in, in, di, uo) is cc_multi.
:- mode main_loop(in, di, uo) is cc_multi.
:- mode main(di, uo) is cc_multi.
-:- pred database_lookup_pred_clause(db_pred, list(my_term(_0)), clause).
-:- pred database_lookup_clause(database, my_term(_0), clause).
-:- pred database_lookup_clause(database, my_term(_0), varset, term, term).
+:- pred database_lookup_pred_clause(db_pred, list(my_term(_2)), clause).
+:- pred database_lookup_clause(database, my_term(_2), clause).
+:- pred database_lookup_clause(database, my_term(_2), varset, term, term).
:- pred database_assert_clause(database, varset, term, database).
:- pred database_init(database).
-:- pred deref_list(list(my_term(_0)), list(my_term(_0)), store(_0), store(_0)).
-:- pred deref(my_term(_0), my_term(_0), store(_0), store(_0)).
-:- pred not_occurs_list(list(my_term(_0)), my_var(_0), store(_0), store(_0)).
-:- pred not_occurs(my_term(_0), my_var(_0), store(_0), store(_0)).
-:- pred unify_list(list(my_term(_0)), list(my_term(_0)), store(_0), store(_0)).
-:- pred unify(my_term(_0), my_term(_0), store(_0), store(_0)).
-:- pred solve(database, my_term(_0), store(_0), store(_0)).
-:- pred my_term_to_term_list(list(my_term(_0)), list(term), varset, varset, map(my_var(_0), var), map(my_var(_0), var), store(_0), store(_0)).
-:- pred my_term_to_term(my_term(_0), term, varset, varset, map(my_var(_0), var), map(my_var(_0), var), store(_0), store(_0)).
-:- pred my_term_to_term_list(list(my_term(_0)), list(term), store(_0), store(_0)).
-:- pred my_term_to_term(my_term(_0), term, store(_0), store(_0)).
-:- pred term_to_my_term_list(list(term), list(my_term(_0)), map(var, my_var(_0)), map(var, my_var(_0)), store(_0), store(_0)).
-:- pred term_to_my_term(term, my_term(_0), map(var, my_var(_0)), map(var, my_var(_0)), store(_0), store(_0)).
-:- pred term_to_my_term_list(list(term), list(my_term(_0)), store(_0), store(_0)).
-:- pred term_to_my_term(term, my_term(_0), store(_0), store(_0)).
+:- pred deref_list(list(my_term(_2)), list(my_term(_2)), store(_2), store(_2)).
+:- pred deref(my_term(_2), my_term(_2), store(_2), store(_2)).
+:- pred not_occurs_list(list(my_term(_2)), my_var(_2), store(_2), store(_2)).
+:- pred not_occurs(my_term(_2), my_var(_2), store(_2), store(_2)).
+:- pred unify_list(list(my_term(_2)), list(my_term(_2)), store(_2), store(_2)).
+:- pred unify(my_term(_2), my_term(_2), store(_2), store(_2)).
+:- pred solve(database, my_term(_2), store(_2), store(_2)).
+:- pred my_term_to_term_list(list(my_term(_2)), list(term), varset, varset, map(my_var(_2), var), map(my_var(_2), var), store(_2), store(_2)).
+:- pred my_term_to_term(my_term(_2), term, varset, varset, map(my_var(_2), var), map(my_var(_2), var), store(_2), store(_2)).
+:- pred my_term_to_term_list(list(my_term(_2)), list(term), store(_2), store(_2)).
+:- pred my_term_to_term(my_term(_2), term, store(_2), store(_2)).
+:- pred term_to_my_term_list(list(term), list(my_term(_2)), map(var, my_var(_2)), map(var, my_var(_2)), store(_2), store(_2)).
+:- pred term_to_my_term(term, my_term(_2), map(var, my_var(_2)), map(var, my_var(_2)), store(_2), store(_2)).
+:- pred term_to_my_term_list(list(term), list(my_term(_2)), store(_2), store(_2)).
+:- pred term_to_my_term(term, my_term(_2), store(_2), store(_2)).
:- pred consult_until_eof_2(read_term, database, database, io__state, io__state).
:- pred consult_until_eof(database, database, io__state, io__state).
:- pred consult(string, database, database, io__state, io__state).
:- pred consult_list(list(string), database, database, io__state, io__state).
-:- pred write_solution(varset, map(var, my_var(_0)), my_term(_0), store(_0), io__state, io__state).
-:- pred print_solutions(varset, map(var, my_var(_0)), my_term(_0), store(_0), database, io__state, io__state).
+:- pred write_solution(varset, map(var, my_var(_2)), my_term(_2), store(_2), io__state, io__state).
+:- pred print_solutions(varset, map(var, my_var(_2)), my_term(_2), store(_2), database, io__state, io__state).
:- pred main_loop_2(read_term, database, io__state, io__state).
:- pred main_loop(database, io__state, io__state).
:- pred main(io__state, io__state).
:- pragma promise_pure(print_solutions / 7).
:- type clause ---> clause(varset, term, term).
-:- type _0 / _1 ---> _0 / _1.
+:- type _2 / _3 ---> _2 / _3.
:- type db_pred ---> db_pred(list(clause), multi_map(string / int, clause)).
:- type database ---> database(list(clause), map(string / int, db_pred)).
-:- type my_term(_0) ---> var(my_var(_0)) ; free ; functor(const, list(my_term(_0))).
-:- type my_var(_0) == mutvar(my_term(_0), _0).
+:- type my_term(_2) ---> var(my_var(_2)) ; free ; functor(const, list(my_term(_2))).
+:- type my_var(_2) == mutvar(my_term(_2), _2).
No (more) solutions.
?- No (more) solutions.
-?- print_solutions(_0, _1, _2, _3, _4) --> { solve(_4, _2, _3, _5) }, { impure write_solution(_0, _1, _2, _5) }, { fail } ; io__write_string("No (more) solutions.\n").
-consult_until_eof_2(term(_0, _1), _2, _3) --> { database_assert_clause(_2, _0, _1, _4) }, consult_until_eof(_4, _3).
-consult_until_eof_2(error(_0, _1), _2, _3) --> io__write_string("Error reading term at line "), io__write_int(_1), io__write_string(" of standard input: "), io__write_string(_0), io__write_string("\n"), consult_until_eof(_2, _3).
-consult_until_eof_2(eof, _0, _0) --> [].
-my_term_to_term(_0, _1) --> { varset__init(_2) }, { map__init(_3) }, my_term_to_term(_0, _1, _2, _4, _3, _5).
-consult_list([_0 | _1], _2, _3) --> consult(_0, _2, _4), consult_list(_1, _4, _3).
-consult_list([], _0, _0) --> [].
-consult(_0, _1, _2) --> io__write_string("Consulting file `"), io__write_string(_0), io__write_string("\'...\n"), io__see(_0, _3), ({ _3 = ok } -> consult_until_eof(_1, _2), io__seen ; io__write_string("Error opening file `"), io__write_string(_0), io__write_string("\' for input.\n"), { _2 = _1 }).
-consult_until_eof(_0, _1) --> term_io__read_term(_2), consult_until_eof_2(_2, _0, _1).
-deref_list([_0 | _1], [_2 | _3]) --> deref(_0, _2), deref_list(_1, _3).
+?- print_solutions(_3, _4, _5, _6, _7) --> { solve(_7, _5, _6, _8) }, { impure write_solution(_3, _4, _5, _8) }, { fail } ; io__write_string("No (more) solutions.\n").
+consult_until_eof_2(term(_3, _4), _5, _6) --> { database_assert_clause(_5, _3, _4, _7) }, consult_until_eof(_7, _6).
+consult_until_eof_2(error(_3, _4), _5, _6) --> io__write_string("Error reading term at line "), io__write_int(_4), io__write_string(" of standard input: "), io__write_string(_3), io__write_string("\n"), consult_until_eof(_5, _6).
+consult_until_eof_2(eof, _3, _3) --> [].
+my_term_to_term(_3, _4) --> { varset__init(_5) }, { map__init(_6) }, my_term_to_term(_3, _4, _5, _7, _6, _8).
+consult_list([_3 | _4], _5, _6) --> consult(_3, _5, _7), consult_list(_4, _7, _6).
+consult_list([], _3, _3) --> [].
+consult(_3, _4, _5) --> io__write_string("Consulting file `"), io__write_string(_3), io__write_string("\'...\n"), io__see(_3, _6), ({ _6 = ok } -> consult_until_eof(_4, _5), io__seen ; io__write_string("Error opening file `"), io__write_string(_3), io__write_string("\' for input.\n"), { _5 = _4 }).
+consult_until_eof(_3, _4) --> term_io__read_term(_5), consult_until_eof_2(_5, _3, _4).
+deref_list([_3 | _4], [_5 | _6]) --> deref(_3, _5), deref_list(_4, _6).
deref_list([], []) --> [].
-main_loop(_0) --> io__write_string("?- "), term_io__read_term(_1), main_loop_2(_1, _0).
-deref(functor(_0, _1), functor(_0, _2)) --> deref_list(_1, _2).
-deref(var(_0), _1) --> tr_store__get_mutvar(_0, _2), ({ _2 \= free } -> deref(_2, _1) ; { _1 = var(_0) }).
-deref(free, _0) --> { error("interpreter__deref: unexpected occurence of `free\'") }.
-main --> io__write_string("Pure Prolog Interpreter.\n\n"), io__command_line_arguments(_0), ({ _0 = [] } -> io__stderr_stream(_1), io__write_string(_1, "Usage: interpreter filename ...\n"), io__set_exit_status(1) ; { database_init(_2) }, consult_list(_0, _2, _3), main_loop(_3)).
-main_loop_2(term(_0, _1), _2) --> { store__init(_3) }, { map__init(_4) }, { term_to_my_term(_1, _5, _4, _6, _3, _7) }, print_solutions(_0, _6, _5, _7, _2), main_loop(_2).
-main_loop_2(error(_0, _1), _2) --> io__write_string("Error reading term at line "), io__write_int(_1), io__write_string(" of standard input: "), io__write_string(_0), io__write_string("\n"), main_loop(_2).
-main_loop_2(eof, _0) --> [].
-my_term_to_term_list(_0, _1) --> { varset__init(_2) }, { map__init(_3) }, my_term_to_term_list(_0, _1, _2, _4, _3, _5).
-not_occurs(functor(_0, _1), _2) --> not_occurs_list(_1, _2).
-not_occurs(var(_0), _1) --> { _0 \= _1 }, tr_store__get_mutvar(_0, _2), ({ _2 = free } -> [] ; not_occurs(_2, _1)).
-my_term_to_term(functor(_0, _1), functor(_0, _2, _3), _4, _5, _6, _7) --> { context_init(_3) }, my_term_to_term_list(_1, _2, _4, _5, _6, _7).
-my_term_to_term(free, variable(_0), _1, _2, _3, _3) --> { varset__new_var(_1, _0, _2) }, { error("my_term_to_term: unexpected free var") }.
-my_term_to_term(var(_0), variable(_1), _2, _3, _4, _5) --> ({ map__search(_4, _0, _6) } -> { _1 = _6 }, { _7 = _2 }, { _8 = _4 } ; { varset__new_var(_2, _1, _7) }, { map__det_insert(_4, _0, _1, _8) }), tr_store__get_mutvar(_0, _9), ({ _9 \= free } -> my_term_to_term(_9, _10, _7, _11, _8, _5), { varset__bind_var(_11, _1, _10, _3) } ; { _5 = _8 }, { _3 = _7 }).
-my_term_to_term_list([_0 | _1], [_2 | _3], _4, _5, _6, _7) --> my_term_to_term(_0, _2, _4, _8, _6, _9), my_term_to_term_list(_1, _3, _8, _5, _9, _7).
-my_term_to_term_list([], [], _0, _0, _1, _1) --> [].
-not_occurs_list([_0 | _1], _2) --> not_occurs(_0, _2), not_occurs_list(_1, _2).
-not_occurs_list([], _0) --> [].
-term_to_my_term_list(_0, _1) --> { map__init(_2) }, term_to_my_term_list(_0, _1, _2, _3).
-term_to_my_term(_0, _1) --> { map__init(_2) }, term_to_my_term(_0, _1, _2, _3).
-solve(_0, _1) --> { database_lookup_clause(_0, _1, _2, _3, _4) }, term_to_my_term_list([_3, _4], [_5, _6]), unify(_1, _5), solve(_0, _6).
-solve(_0, functor(atom("="), [_1, _2])) --> unify(_1, _2).
-solve(_0, functor(atom(";"), [_1, _2])) --> solve(_0, _1) ; solve(_0, _2).
-solve(_0, functor(atom(","), [_1, _2])) --> solve(_0, _1), solve(_0, _2).
-solve(_0, functor(atom("true"), [])) --> [].
-term_to_my_term(functor(_0, _1, _2), functor(_0, _3), _4, _5) --> term_to_my_term_list(_1, _3, _4, _5).
-term_to_my_term(variable(_0), var(_1), _2, _3) --> { map__search(_2, _0, _4) } -> { _1 = _4 }, { _3 = _2 } ; tr_store__new_mutvar(free, _1), { map__det_insert(_2, _0, _1, _3) }.
-unify(functor(_0, _1), functor(_0, _2)) --> unify_list(_1, _2).
-unify(functor(_0, _1), var(_2)) --> tr_store__get_mutvar(_2, _3), ({ _3 \= free } -> unify(functor(_0, _1), _3) ; not_occurs_list(_1, _2), tr_store__set_mutvar(_2, functor(_0, _1))).
-unify(var(_0), functor(_1, _2)) --> tr_store__get_mutvar(_0, _3), ({ _3 \= free } -> unify(_3, functor(_1, _2)) ; not_occurs_list(_2, _0), tr_store__set_mutvar(_0, functor(_1, _2))).
-unify(var(_0), var(_1)) --> tr_store__get_mutvar(_0, _2), tr_store__get_mutvar(_1, _3), ({ _2 \= free } -> ({ _3 \= free } -> unify(_2, _3) ; deref(_2, _4), ({ _4 = var(_1) } -> [] ; not_occurs(_4, _1), tr_store__set_mutvar(_1, _4))) ; { _3 \= free } -> deref(_3, _5), ({ _5 = var(_0) } -> [] ; not_occurs(_5, _0), tr_store__set_mutvar(_0, _5)) ; { _0 = _1 } -> [] ; tr_store__set_mutvar(_0, var(_1))).
-term_to_my_term_list([_0 | _1], [_2 | _3], _4, _5) --> term_to_my_term(_0, _2, _4, _6), term_to_my_term_list(_1, _3, _6, _5).
-term_to_my_term_list([], [], _0, _0) --> [].
-unify_list([_0 | _1], [_2 | _3]) --> unify(_0, _2), unify_list(_1, _3).
+main_loop(_3) --> io__write_string("?- "), term_io__read_term(_4), main_loop_2(_4, _3).
+deref(functor(_3, _4), functor(_3, _5)) --> deref_list(_4, _5).
+deref(var(_3), _4) --> tr_store__get_mutvar(_3, _5), ({ _5 \= free } -> deref(_5, _4) ; { _4 = var(_3) }).
+deref(free, _3) --> { error("interpreter__deref: unexpected occurence of `free\'") }.
+main --> io__write_string("Pure Prolog Interpreter.\n\n"), io__command_line_arguments(_3), ({ _3 = [] } -> io__stderr_stream(_4), io__write_string(_4, "Usage: interpreter filename ...\n"), io__set_exit_status(1) ; { database_init(_5) }, consult_list(_3, _5, _6), main_loop(_6)).
+main_loop_2(term(_3, _4), _5) --> { store__new(_6) }, { map__init(_7) }, { term_to_my_term(_4, _8, _7, _9, _6, _10) }, print_solutions(_3, _9, _8, _10, _5), main_loop(_5).
+main_loop_2(error(_3, _4), _5) --> io__write_string("Error reading term at line "), io__write_int(_4), io__write_string(" of standard input: "), io__write_string(_3), io__write_string("\n"), main_loop(_5).
+main_loop_2(eof, _3) --> [].
+my_term_to_term_list(_3, _4) --> { varset__init(_5) }, { map__init(_6) }, my_term_to_term_list(_3, _4, _5, _7, _6, _8).
+not_occurs(functor(_3, _4), _5) --> not_occurs_list(_4, _5).
+not_occurs(var(_3), _4) --> { _3 \= _4 }, tr_store__get_mutvar(_3, _5), ({ _5 = free } -> [] ; not_occurs(_5, _4)).
+my_term_to_term(functor(_3, _4), functor(_3, _5, _6), _7, _8, _9, _10) --> { context_init(_6) }, my_term_to_term_list(_4, _5, _7, _8, _9, _10).
+my_term_to_term(free, variable(_3), _4, _5, _6, _6) --> { varset__new_var(_4, _3, _5) }, { error("my_term_to_term: unexpected free var") }.
+my_term_to_term(var(_3), variable(_4), _5, _6, _7, _8) --> ({ map__search(_7, _3, _9) } -> { _4 = _9 }, { _10 = _5 }, { _11 = _7 } ; { varset__new_var(_5, _4, _10) }, { map__det_insert(_7, _3, _4, _11) }), tr_store__get_mutvar(_3, _12), ({ _12 \= free } -> my_term_to_term(_12, _13, _10, _14, _11, _8), { varset__bind_var(_14, _4, _13, _6) } ; { _8 = _11 }, { _6 = _10 }).
+my_term_to_term_list([_3 | _4], [_5 | _6], _7, _8, _9, _10) --> my_term_to_term(_3, _5, _7, _11, _9, _12), my_term_to_term_list(_4, _6, _11, _8, _12, _10).
+my_term_to_term_list([], [], _3, _3, _4, _4) --> [].
+not_occurs_list([_3 | _4], _5) --> not_occurs(_3, _5), not_occurs_list(_4, _5).
+not_occurs_list([], _3) --> [].
+term_to_my_term_list(_3, _4) --> { map__init(_5) }, term_to_my_term_list(_3, _4, _5, _6).
+term_to_my_term(_3, _4) --> { map__init(_5) }, term_to_my_term(_3, _4, _5, _6).
+solve(_3, _4) --> { database_lookup_clause(_3, _4, _5, _6, _7) }, term_to_my_term_list([_6, _7], [_8, _9]), unify(_4, _8), solve(_3, _9).
+solve(_3, functor(atom("="), [_4, _5])) --> unify(_4, _5).
+solve(_3, functor(atom(";"), [_4, _5])) --> solve(_3, _4) ; solve(_3, _5).
+solve(_3, functor(atom(","), [_4, _5])) --> solve(_3, _4), solve(_3, _5).
+solve(_3, functor(atom("true"), [])) --> [].
+term_to_my_term(functor(_3, _4, _5), functor(_3, _6), _7, _8) --> term_to_my_term_list(_4, _6, _7, _8).
+term_to_my_term(variable(_3), var(_4), _5, _6) --> { map__search(_5, _3, _7) } -> { _4 = _7 }, { _6 = _5 } ; tr_store__new_mutvar(free, _4), { map__det_insert(_5, _3, _4, _6) }.
+unify(functor(_3, _4), functor(_3, _5)) --> unify_list(_4, _5).
+unify(functor(_3, _4), var(_5)) --> tr_store__get_mutvar(_5, _6), ({ _6 \= free } -> unify(functor(_3, _4), _6) ; not_occurs_list(_4, _5), tr_store__set_mutvar(_5, functor(_3, _4))).
+unify(var(_3), functor(_4, _5)) --> tr_store__get_mutvar(_3, _6), ({ _6 \= free } -> unify(_6, functor(_4, _5)) ; not_occurs_list(_5, _3), tr_store__set_mutvar(_3, functor(_4, _5))).
+unify(var(_3), var(_4)) --> tr_store__get_mutvar(_3, _5), tr_store__get_mutvar(_4, _6), ({ _5 \= free } -> ({ _6 \= free } -> unify(_5, _6) ; deref(_5, _7), ({ _7 = var(_4) } -> [] ; not_occurs(_7, _4), tr_store__set_mutvar(_4, _7))) ; { _6 \= free } -> deref(_6, _8), ({ _8 = var(_3) } -> [] ; not_occurs(_8, _3), tr_store__set_mutvar(_3, _8)) ; { _3 = _4 } -> [] ; tr_store__set_mutvar(_3, var(_4))).
+term_to_my_term_list([_3 | _4], [_5 | _6], _7, _8) --> term_to_my_term(_3, _5, _7, _9), term_to_my_term_list(_4, _6, _9, _8).
+term_to_my_term_list([], [], _3, _3) --> [].
+unify_list([_3 | _4], [_5 | _6]) --> unify(_3, _5), unify_list(_4, _6).
unify_list([], []) --> [].
-write_solution(_0, _1, _2, _3) --> { map__keys(_1, _4) }, { map__values(_1, _5) }, { map__from_corresponding_lists(_5, _4, _6) }, { my_term_to_term(_2, _7, _0, _8, _6, _9, _3, _10) }, term_io__write_term_nl(_8, _7).
+write_solution(_3, _4, _5, _6) --> { map__keys(_4, _7) }, { map__values(_4, _8) }, { map__from_corresponding_lists(_8, _7, _9) }, { my_term_to_term(_5, _10, _3, _11, _9, _12, _6, _13) }, term_io__write_term_nl(_11, _10).
No (more) solutions.
?-
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
The University of Melbourne | of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list