[mercury-users] field access function

Peter Wang novalazy at gmail.com
Thu Oct 18 10:31:16 AEST 2007


On 2007-10-18, Nicholas Nethercote <njn at csse.unimelb.edu.au> wrote:
> 
>  Hi,
> 
>  If I have this type:
> 
> 
>  :- type id
>     ---> id(
>              name            :: string,
>              scope_number    :: int
>          ).
> 
> 
>  should I be able to use 'name' as an access function like this?
> 
>    Name = map(name, Ids)
> 
>  where 'Ids' is a list of 'id'?  I thought you could, but it doesn't seem to 
>  work.

You need to provide the type and mode declaration.  See "3.4.3
User-supplied field access function declarations" in the reference
manual.

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