[mercury-users] A subtlety about DCG variable threading

Ralph Becket rbeck at microsoft.com
Thu Apr 26 23:25:45 AEST 2001


>  > Your confusion seems to be based on a false assumption --
>  > the call to `process' there is indeed a call to process/5.
>  >
> 
> Well, if it is indeed process/5, then why this:
> 
> 	process(add_verb_object(Verb, Object), DB0, DB) -->
> 		{ DB = add_to_db(DB0, Verb, Object) }.
> 
> 
> This term is of arity 3 as far as I can see... and it is the source of
> my assumption.

The expansion of the above is

process(add_verb_object(Verb, Object), DB0, DB, DCG0, DCG) :-
	DB = add_to_db(DB0, Verb, Object),
	DCG = DCG0.

`process' does indeed have arity 5 - the `-->' arrow means "this
definition
requires extra DCG arguments to be threaded throughout".

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