[mercury-users] record field access syntax
Simon Taylor
stayl at cs.mu.OZ.AU
Sun Jan 6 19:15:38 AEDT 2002
On 06-Jan-2002, Dave Slutzkin <dave_slutzkin at yahoo.com> wrote:
> main -->
> { T = test(1,2) } ,
> { T ^ one := 3 } ,
> print(T ^ one) , nl.
>
> Why do I get this error message?
>
> test2.m:021: Error: expected `Field =^ field1 ^ ... ^
> fieldN'
> test2.m:021: or `^ field1 ^ ... ^ fieldN := Field'.
> test2.m:021: in DCG field access goal.
>
> If I'm reading it right, this should work as well:
>
> main -->
> { T = test(1,2) } ,
> { 'one :='(T,3) } ,
> print(T ^ one) , nl.
>
> In this instance I get `undefined predicate 'one
> :=/2''.
The function 'one :=/2' doesn't do destructive update,
it returns a modified copy.
main -->
{ T0 = test(1,2) } ,
{ T = T0 ^ one := 3 } ,
print(T ^ one) , nl.
Simon.
--------------------------------------------------------------------------
mercury-users mailing list
post: mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the users
mailing list