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

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Jul 24 12:18:20 AEST 2008


On Thu, 24 Jul 2008, Peter Ross wrote:

> On Thu, Jul 24, 2008 at 10:55 AM, Peter Wang <novalazy at gmail.com> wrote:
>> 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?
>>
> I would suggest "lambda in pre.main/2 on line xx"

What would happen for nested lambdas?  Would it be

 	lambda in lambda in pred.main/2 on linx xx

What if I have two lambda expressions on a single line?
(It's not something I am likely to do in practice but it is possible?)

What do the debugger/profilers do when printing out the names of
lambdas?

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