[mercury-users] discriminated union question

Richard A. O'Keefe ok at atlas.otago.ac.nz
Wed Apr 18 10:28:13 AEST 2001


"Ralph Becket" <rbeck at microsoft.com> wrote:
	I've been meaning to change the definition for pair to use {}/2 tuples
	and replace -/2 over pairs with a function with the appropriate set of
	modes.  pair/2 does crop up in several places in the library, but I'd
	encourage people to move to the new tuple types where possible.
	
Erlang uses {Key,Value} for pairs rather than Prolog's Key-Value.
It's probably the single UGLIEST thing in Erlang.

I willingly grant that - is not the ideal operator for this purpose.
It's certainly not the one that I would have chosen to use.
I would almost certainly have pressed (->)/2 into service for this
purpose.  That's the operator that Smalltalk uses for making Associations.
I might possibly have used => or : or even :->.

Heck, if you want to use "mathematical" notation for pairs,
then you shouldn't use {Key,Value} but {Key,{Key,Value}}.

An important advantage of the (-)/2 pair constructor is that it is
*different* from generic tuples.  It would be a great pity to lose that.

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