[m-dev.] Mercury Tutorial Book

Tyson Dowd trd at cs.mu.OZ.AU
Sun Oct 7 12:57:01 AEST 2001


On 06-Oct-2001, Michael Day <mikeday at bigpond.net.au> wrote:
> 
> > - should have a strong section on IO;
> 
> It needs to explain transformations such as DCGs in a way that makes
> sense... I still don't really understand what it means to have a list
> expression in a DCG predicate :|

Took me a while to figure it out too.

foo -->
	[1, 2, 3],
	[4, 5, 6].

becomes

foo(X0, X) :-
	X0 = [1, 2, 3 | X1],
	X1 = [4, 5, 6 | X2],
	X = X2.

Your comment is quite valid though -- in particular the idiom of putting

foo -->
	[].

is common and it isn't clear at first that it expands to

foo(X0, X) :-
	X0 = X.


-- 
       Tyson Dowd           # 
                            #  Surreal humour isn't everyone's cup of fur.
     trd at cs.mu.oz.au        # 
http://www.cs.mu.oz.au/~trd #
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list