[mercury-users] Constructor question.

Ian MacLarty maclarty at csse.unimelb.edu.au
Sat Apr 14 21:21:43 AEST 2012


On Sat, Apr 14, 2012 at 9:20 PM, Ian MacLarty
<maclarty at csse.unimelb.edu.au> wrote:
> On Sat, Apr 14, 2012 at 9:03 PM, Michael Richter <ttmrichter at gmail.com> wrote:
>> On 14 April 2012 17:26, Mark Brown <mark at csse.unimelb.edu.au> wrote:
>>>
>>> > > Foo = foo(  10       % bar
>>> > >             "eleven" % baz
>>> > >          ).
>>>
>>> You can write
>>>
>>>    (_ ^ bar := 10)
>>>       ^ baz := "eleven"
>>>
>>> to construct the above term.
>>
>>
>> Thanks for the pointer.
>>
>> How would that look if I want to explicitly initialize the quux field?
>>  This…
>>
>>> ((_ ^ bar := 10)
>>>     ^ baz := "eleven")
>>>     ^ quux := yes
>>
>>
>> …could start to get a bit quirky-looking if I want to initialize a dozen
>> members.
>>
>> --
>> "Perhaps people don't believe this, but throughout all of the discussions of
>> entering China our focus has really been what's best for the Chinese people.
>> It's not been about our revenue or profit or whatnot."
>> --Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.
>
> You can also do something like this:
>
> Foo.bar = 10,
> Foo.baz = "eleven",
> Foo.quux = yes,
>
> (you must fill in all fields for Foo to become ground).
>

Sorry, I mean:

Foo ^ bar = 10,
Foo ^ baz = "eleven",
Foo ^ quux = yes,

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