[mercury-users] A suggestion for a tutorial

Nicolas Pelletier nicolas.pelletier3 at free.fr
Wed Jul 5 04:07:51 AEST 2006


schachte at csse.unimelb.edu.au (Peter Schachte) writes:

> On Tue, Jul 04, 2006 at 10:07:16AM +1000, Peter Schachte wrote:
>> You might write:
>> 
>>     square_list(0, _, []).
>>     square_list(N, M, [X|L]) :-
>>         N>0, member(X, 1 .. M), square_list(N - 1, M, L0).
>
> Oops, change L0 to L.

Yes. Thank you for this explanation, it  helps putting things straight
in my head. I had thought at first defining a predicate using multiple
clauses worked the same as  defining functions using pattern matching,
as in Haskell for example.

Regards,

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