[mercury-users] Pred defns
Peter Schachte
pets at students.cs.mu.OZ.AU
Thu Mar 26 09:33:27 AEDT 1998
On Wed, 25 Mar 1998, Ralph Becket wrote:
> Peter Phelan wrote on 25 Mar:
> > How come the declarative definition takes just one argument,
> > whilst there are 3 in the type declaration?
>
> With the best will in the world, RTFM. Have a look at
I think this is a fair question. It *is* confusing and
counterintuitive to have a predicate declared with 3 arguments,
defined with 1 argument, and called with either 1 or 3 arguments.
It's also easy to miss the --> where the :- should have been. And
even if you notice it, how do you know where to look in the manual.
I think it would be worth putting a note in the reference manual where
it talks about pred declarations that a predicate can be defined with
two fewer arguments than it is declared with if it is defined as a
DCG, and refer to the DCG section.
Better still, I think there should be a specialized syntax for
declaring DCG predicates, ideally some variation on the EDCG
notation. There should also be a special syntax for calling DCG
predicates from non-DCG code; maybe something like phrase/2,3 in Prolog.
Then the current practice of declaring and calling DCG predicates with
2 extra arguments should be phased out.
-Peter Schachte | The secret of being miserable is to have the
pets at cs.mu.OZ.AU | leisure to bother about whether you are
http://www.cs.mu.oz.au/~pets/ | happy or not. The cure is occupation.
PGP key available on request | -- George Bernard Shaw
More information about the users
mailing list