[mercury-users] functions vs predicates (was Re: State variable problem
Mark Brown
mark at csse.unimelb.edu.au
Mon Aug 14 18:03:18 AEST 2006
On 14-Aug-2006, Nicholas Nethercote <njn at csse.unimelb.edu.au> wrote:
>
> >On 21-Jul-2006, Peter Moulder <Peter.Moulder at infotech.monash.edu.au> wrote:
> >>On Wed, May 31, 2006 at 11:29:44AM +1000, Ralph Becket wrote:
> >>
> >>>I used to think the same way [that function calls are just an
> >>>alternative syntax for predicate calls], but I've been convinced
> >>>otherwise. The main thing is that with functions it is natural to
> >>>assume referential transparency.
> >>
> >>That may well be a natural assumption, but it's unfortunately a false
> >>one in Mercury: that is, the code
> >>
> >> f \= f
> >>
> >>can succeed (where f is a function application in the usual forward
> >>direction)
>
> How?
If `f' fails, then then atomic goal `f = f' fails. Thus `not (f = f)'
succeeds, and `f \= f' is syntactic sugar for just that.
Cheers,
Mark.
--------------------------------------------------------------------------
mercury-users mailing list
Post messages to: mercury-users at csse.unimelb.edu.au
Administrative Queries: owner-mercury-users at csse.unimelb.edu.au
Subscriptions: mercury-users-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the users
mailing list