[mercury-users] Simple program
Tomas By
tomas at basun.net
Tue Sep 20 00:39:47 AEST 2011
Works fine for me.
| $ mmc --make testlist
| Making Mercury/int3s/testlist.int3
| Making Mercury/ints/testlist.int
| Making Mercury/cs/testlist.c
| Making Mercury/os/testlist.o
| Making testlist
| $ ./testlist
| 1
| 2
| 3$
(You should add a newline at the end.)
/Tomas
On Mon, September 19, 2011 16:28, Denis Kononenko wrote:
> hmmmm
>
> I use command line: mmc --make testlist
>
> testlist.m
> ------------------------
> :- module testlist.
> :- interface.
> :- import_module io.
>
> :- pred main(io::di, io::uo) is det.
>
> :- implementation.
> :- import_module list.
>
> main(!IO) :- L=[1,2,3], io.write_list(L, "\n", io.write_int, !IO).
> ------------------------
>
> What should I do?
>
> PS
> mmc --version
> Mercury Compiler, version 11.01, configured for x86_64-apple-darwin10.8.0
> Copyright (C) 1993-2011 The University of Melbourne
>
>
>
>
> 19.09.2011, â 20:08, Tomas By íàïèñàë(à):
>
>> Hi,
>>
>> Your code has ten lines and the compiler reports an error at line 26?
>>
>> It compiles and runs ok for me.
>>
>> /Tomas
>>
>>
>>
>> On Mon, September 19, 2011 15:53, Denis Kononenko wrote:
>>> Hello!
>>> Please help me
>>>
>>> ------------------------------------------------
>>> :- module learn2.
>>> :- interface.
>>> :- import_module io.
>>>
>>> :- pred main(io::di, io::uo) is det.
>>>
>>> :- implementation.
>>> :- import_module list.
>>>
>>> main(!IO) :- io.write_list([1], "\n", io.write_int, !IO).
>>> ------------------------------------------------
>>> bash-3.2$ mmc --make learn2
>>> Making Mercury/int3s/learn2.int3
>>> Making Mercury/ints/learn2.int
>>> Making Mercury/cs/learn2.c
>>> Making Mercury/os/learn2.o
>>> learn2.m:26: error: initializer element is not constant
>>> learn2.m:26: error: (near initialization for
>>> learn2_scalar_common_1[0][1])
>>> ** Error making `Mercury/os/learn2.o'.
>>>
>>> Why I have error?
>>> --------------------------------------------------------------------------
>>> mercury-users mailing list
>>> Post messages to: mercury-users at csse.unimelb.edu.au
>>> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
>>> Subscriptions: mercury-users-request at csse.unimelb.edu.au
>>> --------------------------------------------------------------------------
>>>
>>
>>
>> --------------------------------------------------------------------------
>> mercury-users mailing list
>> Post messages to: mercury-users at csse.unimelb.edu.au
>> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
>> Subscriptions: mercury-users-request at csse.unimelb.edu.au
>> --------------------------------------------------------------------------
>
>
> --------------------------------------------------------------------------
> mercury-users mailing list
> Post messages to: mercury-users at csse.unimelb.edu.au
> Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
> Subscriptions: mercury-users-request at csse.unimelb.edu.au
> --------------------------------------------------------------------------
>
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list