[m-users.] problem with unique modes

Tomas By tomas at basun.net
Tue Jun 16 08:31:20 AEST 2015


Hello,

In the documentation you link to it says `it is not possible to use nested
unique modes, i.e. modes in which anything but the top level of a variable
is unique'

The elements of a list are not on the top level, so cannot be di/uo, if I
understand it correctly.

Am I right in guessing you are doing this because you think (ie hope) it
may be more efficient?

/Tomas



On Mon, June 15, 2015 20:09, Matthias Güdemann wrote:
> Hi,
>
> I defined a data type which holds two state variables, like in
>
> ,----
> | :- type state --->
> |         state(
> |            substate1 :: state1,
> |            substate2 :: state2
> |            ).
> `----
>
> Now I'd like to have predicates that advance a 'state' by advancing the
> substates, i.e. a predicate has 'state::di' and 'state::uo' arguments
> and calls others with analogous arguments for substate1 and substate2.
>
> The problem is that I get lots of unique mode errors. Is this because I
> am doing it wrong? Or is it because of the limits described in the
> documentation[1]?
>
> My principal goal is to have a list of states that are advanced
> iteratively by a predicate that takes a list of 'di' inputs and creates
> a list of 'uo' moded outputs. How is this handled in general?
>
> Best regards,
> Matthias
>
> Footnotes:
> [1]
> http://mercurylang.org/information/doc-release/mercury_ref/Limitations-of-the-current-implementation.html#Limitations-of-the-current-implementation
>
> _______________________________________________
> users mailing list
> users at lists.mercurylang.org
> https://www.mercurylang.org/lists/listinfo/users
>





More information about the users mailing list