[mercury-users] Beyond "Hello World"

Ralph Becket rafe at cs.mu.OZ.AU
Fri Feb 25 11:08:38 AEDT 2005


(I've resent a response to your earlier message.  My replay was, I
think, rejected because of an attachment.)

Martin Proud, Thursday, 24 February 2005:
> I went ahead and added that line and re-compiled factorial.m. I got the  
> same errors as before, I believe, except for the warnings about the  
> first line:
> 
> factorial.m:001: Warning: module should start with a `:- module'  
> declaration.
> factorial.m:001: Syntax error at token 'i': operator or `.' expected.
> factorial.m:  1: Warning: interface for module `factorial' does not  
> export anything.
>                 To be useful, a module should export something.
>                 A file should contain at least one declaration other  
> than
>                 `:- import_module' in its interface section(s).
>                 This would normally be a `:- pred', `:- func', `:-  
> type',
>                 `:- inst' or `:- mode' declaration.
> factorial.m:007: In clause for predicate `factorial.factorial/2':
> factorial.m:007:   error: undefined predicate `=</2'.
> factorial.m:010: In clause for predicate `factorial.factorial/2':
> factorial.m:010:   error: undefined symbol `-/2'.
> factorial.m:012: In clause for predicate `factorial.factorial/2':
> factorial.m:012:   error: undefined symbol `*/2'.
> 
> Here's the code I'm using as a part of factorial.m (maybe I have  
> something wrong here? I'm pretty sure I just copied it from the  
> tutorial?):
> 
> :- import_module int i.
> 
> :- pred factorial(int, int).
> :- mode factorial(in, out) is det.
> 
> factorial(N, F) :-
>     ( N =< 0 ->
>         F = 1
>     ;
>         N1 is N - 1,
>         factorial(N1, F1),
>         F is F1 * N
>     ).
> 
> 
> Martin Proud
> mproud at knox.edu
> 309 / 341-8875
> K1291
> 
> On Feb 24, 2005, at 5:27 AM, Fergus Henderson wrote:
> 
> >On 23-Feb-2005, Martin Proud <mproud at knox.edu> wrote:
> >>"Hello World" compiles and runs, thankfully. So I'm looking for some
> >>other programs to test. I tried running some in Ralph Beckett's
> >>tutorial (I'm assuming they're programs and not snippets? Maybe I'm
> >>wrong?) but I am getting errors. For example, for factorial:
> >>
> >>factorial.m:005: In clause for predicate `factorial.factorial/2':
> >>factorial.m:005:   error: undefined predicate `=</2'.
> >
> >Did you miss the ":- import_module int." line?
> >
> >If not... is that the only error message?  Were there any messages
> >before that?
> >
> >--  
> >Fergus Henderson                    |  "I have always known that the  
> >pursuit
> >                                    |  of excellence is a lethal habit"
> >WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S.  
> >Garp.
> >----------------------------------------------------------------------- 
> >---
> >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
> >----------------------------------------------------------------------- 
> >---
> >---
> >[This E-mail scanned for viruses by Declude Virus]
> >
> >
> >
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
--------------------------------------------------------------------------
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