[m-users.] Cannot execute a predicate from a Discriminated Union

Tomas By tomas at basun.net
Sun Jun 28 11:07:45 AEST 2015


On Sun, June 28, 2015 02:56, Charles Shuller wrote:
> Also does not work.

The attached version compiles.

This bit:

| execute_test(Test, Disposition) :-
|   call(Test^test_pred, Disposition),
|   Disposition = fail(Test^test_name ++ " Failed to execute").

is strange - Disposition is an out parameter, and you seem to be trying to
assign a value to it twice. My version just ignores the return value of
the call.

You could do something like:

| execute_test(Test, Disposition) :-
|   call(Test^test_pred, D),
|   ( D = pass ->
|     Disposition = pass
|   ; Disposition = fail(Test^test_name ++ " Failed to execute") ).


/Tomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: manual_test.m
Type: text/x-objcsrc
Size: 849 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20150628/50370140/attachment.bin>


More information about the users mailing list