[mercury-users] $pred doesn't work in lambda expressions

Peter Wang novalazy at gmail.com
Thu Jul 24 10:55:14 AEST 2008


On 2008-06-26, Peter Wang <novalazy at gmail.com> wrote:
> On 2008-06-26, Nicholas Nethercote <njn at csse.unimelb.edu.au> wrote:
> >
> > Hi,
> >
> > I tried using $pred in a lambda expression and got this:
> >
> >   Uncaught Mercury exception:
> >   Software Error: hlds_code_util.m: Unexpected: cons_id_to_tag: implementation_defined_const
> >
> > It's easy to work around, but I thought it might be worth mentioning.
> 
> Thanks for pointing it out.  Added to the bug tracker.

This was fixed about a month ago.  However,

    main(!IO) :-
        P = (pred(!.IO::di, !:IO::uo) is det :-
            io.write_string($pred, !IO),
            io.nl(!IO)
        ),
        P(!IO).

will print

    predicate `pre.main'/2

which, while correct by one view, seems counter-intuitive.
Any suggestions on how to expand $pred in lambdas?

Peter

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