[mercury-users] Incomprehensible error output, even with -E.
juliensf at csse.unimelb.edu.au
Thu Feb 2 19:07:11 AEDT 2012
On Thu, 2 Feb 2012, Michael Richter wrote:
> On 2 February 2012 05:50, Julian Fondren <ayrnieu at gmail.com> wrote:
>> to make the problem clearer, you have here
>> A = (func(X) = B, C),
>> How is this not like your definitions of named functions?
> It's got a lambda instead of a :- func body?
It has nothing to with it being a lamda.
> Maybe I'm fundamentally misunderstanding the syntax of funcs vs. preds.
> (There doesn't appear to be a grammar for Mercury in the language
> reference so I'm only inferring what's permitted and what's not.)
For the syntax of functions see the ``Rules'' section of the reference
manual (Section 2.8). Of relevance here are the following statements
from that section.
A function rule is an item of the form ``Head = Result :- Body''.
The Result and the arguments of Head must be valid data-terms.
The Body must be a valid goal.
In this instance we have ``func(X) = B, C''. "B, C" is a goal, *not*
a data-term (i.e an expression). That is what the initial error
message is trying to tell you:
man_or_boy.m:030: In clause for predicate `main'/2:
man_or_boy.m:030: ï¿½ error: the language construct `,'/2 should be used as a
man_or_boy.m:030: ï¿½ goal, not as an expressn
More information about the users