[mercury-users] Restricted types with inst declarations? ELL type/inst usage?
David Overton
dmo at cs.mu.OZ.AU
Wed Feb 22 10:37:09 AEDT 2006
doug.auclair at logicaltypes.com wrote:
> Dear Ian, thank you for the inst question solution! You also wrote:
>
>
>>But why don't you just do:
>>
>>:- type bit
>> ---> one
>> ; zero.
>>
>>I think that would make your life simpler.
>
> You are absolutely right on all counts. So thank you for humouring me
> on this inst issue. It's also a question of (*sigh*) semantics and
> conciseness. 1 and 0 are fairly strongly embedded into the mode of
> discourse, so reading something in the code like:
>
> Rule0 = [111 - 0, 110 - 0, 101 - 0, 100 - 1, 011 - 1, 010 - 1, 001 -
1, 000 - 0]
>
> is much easier for one to grasp* than
>
> Rule1 = [[one, one, one] - zero, [zero, one, one] - zero, [one, zero,
one] - zero, [zero, zero, one] - one,
> [one, one, zero] - one, [zero, one, zero] - one, [one,
zero, zero] - one, [zero, zero, zero] - zero] +
>
>
> and, having Rule0 be proved type-correct at compile-time is the
benefit I'm looking for.
If you need to use the symbols 0 and 1 then how about
:- type bit
---> '0'
; '1'.
?
David
--
David Overton
http://www.overtons.id.au/
http://flickr.com/photos/overton/
Mobile: +44 7799 344 322
--------------------------------------------------------------------------
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