[mercury-users] Prev code modified

Ralph Becket rafe at cs.mu.OZ.AU
Tue Oct 15 10:41:00 AEST 2002


Noel  Pinto, Monday, 14 October 2002:
> On Mon, 14 Oct 2002 Ralph Becket wrote :
> >
> >You need to rewrite numSqre/2 as a single-argument function and 
                                                      ^^^^^^^^

> >If you use io__write_string and io__write_int, you will get much 
> >clearer error messages from the compiler.      ^^^^^^^^^^^^^^^^^
   ^^^^^^^^^^^^^^^^^^^^^^

> I did the change as you told me to... But I get one error now.
> main-->
>         print("Enter an int: "), flush_output,
>         read_int(Int),
>         print("The Square is : "), 
> io__write_int(numSqr__numSqre(Int)), nl. % This is line 12
> 
> The error is ...
> 
> read_int.m:012: In clause for predicate `read_int:main/2':
> read_int.m:012:   in argument 1 of call to predicate 
> `io:write_int/3':
> read_int.m:012:   type error: argument has type `(pred)',
> read_int.m:012:   expected type was `int'.

Which leads us to conclude that numSqr__numSqre(Int) cannot have type
Int as you have written it.

But you haven't shown us the code for numSqr__numSqre, so I can't offer
any help.

My guess is that you have written something like

:- pred numSqr__numSqre(int).
...

which, of course, is not a function.  In particular, it has no result.

- Ralph
--------------------------------------------------------------------------
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