[mercury-users] cant import int altthough i have the import command...
Stefan Hinterstoisser
supersteveee at gmx.de
Thu Mar 18 18:06:56 AEDT 2004
Hi there!
I wrote following program:
:- module hello.
:- interface.
:- import_module io.
:- pred main(io.state, io.state).
:- mode main(di, uo) is det.
:- implementation.
:- import_module char.
:- import_module int.
:- pred bo( U :: int ).
:- mode bo( in ) is semidet.
:- pred row( X :: int, Y :: int, Z :: int).
:- mode row( in, in, in) is semidet.
%:- mode row( out, in, in) is nondet.
%:- mode row( in, out, in) is nondet.
%:- mode row( in, in, out) is nondet.
%:- mode row( in, out, out) is nondet.
%:- mode row( out, out, in) is nondet.
%:- mode row( out, in, out) is nondet.
:- pred column( A :: int, B :: int).
:- mode column( in, in) is semidet.
%:- mode column( out, in) is nondet.
%:- mode column( in, out) is nondet.
bo(U) :-
U = 1.
row( X, Y, Z) :-
bo(X);
bo(Y);
bo(Z).
column( A, C) :-
bo(A);
bo(C).
main( !IO ) :-
io.write_string("Start the Declarative Program!\n", !IO),
row( A1,A2,A3),
row(B1,B2,B3),
not( column(A1,B1) ),
column(A2,B2),
not( column(A3,B3) ),
io.write_string("A1=", !IO),
io.write_string(char.to_int(A1), !IO),
io.nl(!IO),
io.write_string("B1=", !IO),
io.write_string(char.to_int(B1), !IO),
io.nl(!IO),
io.write_string("B2=", !IO),
io.write_string(char.to_int(B2), !IO),
io.nl(!IO),
io.write_string("A2=", !IO),
io.write_string(char.to_int(A2), !IO),
io.nl(!IO),
io.write_string("B3=", !IO),
io.write_string(char.to_int(B3), !IO),
io.nl(!IO),
io.write_string("A3=", !IO),
io.write_string(char.to_int(A3), !IO),
io.nl(!IO).
but the compiler gives me the following error messages:hello.m:015:
In definition of predicate `hello.bo'/1:
hello.m:015: error: undefined mode `int'/0.
hello.m:018: In definition of predicate `hello.row'/3:
hello.m:018: error: undefined mode `int'/0.
hello.m:018: In definition of predicate `hello.row'/3:
hello.m:018: error: undefined mode `int'/0.
hello.m:018: In definition of predicate `hello.row'/3:
hello.m:018: error: undefined mode `int'/0.
hello.m:027: In definition of predicate `hello.column'/2:
hello.m:027: error: undefined mode `int'/0.
hello.m:027: In definition of predicate `hello.column'/2:
hello.m:027: error: undefined mode `int'/0.
what did I do in the wrong way? And - if somebody knows can I state a
declarative querie (like a SQL querie) like I did it in the middle part?
row( A1,A2,A3),
row(B1,B2,B3),
not( column(A1,B1) ),
column(A2,B2),
not( column(A3,B3) ),
Is it allowed or do I first have to instanciate A1,A2,... ??? What I want to
get is that the program backtracks all possible values that makes the
statement come true (and gives them out). Maybe I should take bools, because he has
to compute all values (-2000000 / +2000000). What do you think (sorry about
these "silly" questions, but I am an absolute newby on this area...).
Thanx in advance,
Stefan
--
+++ NEU bei GMX und erstmalig in Deutschland: TÜV-geprüfter Virenschutz +++
100% Virenerkennung nach Wildlist. Infos: http://www.gmx.net/virenschutz
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list