[mercury-users] Suggestion: new operator

Richard A. O'Keefe ok at atlas.otago.ac.nz
Fri Oct 20 10:47:04 AEDT 2000


Ralph Becket wrote:
	We now have a selection of infix operators for common tasks (`^' for 
	field access, `++' for concatenation etc.)  I propose adding `@' as a
	synonym for `lookup' operations:
	
	Map @ Key     <=> map__lookup(Map, Key)
	String @ Idx  <=> string__unsafe_index(String, Idx)
	Array @ Idx   <=> array__lookup(Array, Idx)

Since '@' is pronounced 'at', and since 'Map at Key' makes sense, I suppose
we could get away with it.  I've just been writing Haskell, so I read '@'
as 'as' (AS-patterns can be X=pat, X as pat, X at pat, X=:pat depending on
which of several languages I use, it's all very confusing really).

For what it's worth, Eiffel uses Collection @ Index.

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