[mercury-users] equality functions

Ralph Becket rbeck at microsoft.com
Tue Mar 21 22:00:21 AEDT 2000


> Say you had an array of integers, and wanted to create 
> another array of
> booleans stating whether the corresponding integer was greater than 5,
> currying '<' and using it as a function would be one solution?

I doubt such functionality would be useful often enough to warrant
going into the library.  It's probably better to map

	(func(X) = (if X > 5 then yes else no))

over the array; if you do this sort of thing all over the place in
a program then just knock up a few special functions of your own.
In general, changing the behaviour of well understood symbols
quickly leads to confusion.

> Does X = Y = Z already have a meaning in Mercury?

That should be a syntax error since =/2 has associativity xfx, which
means that you *have* to put the brackets in here.

Cheers,

Ralph

--
Ralph Becket      |      MSR Cambridge      |      rbeck at microsoft.com
--------------------------------------------------------------------------
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