[m-dev.] Introduce !! rather than ^elem() for indexing

Fergus Henderson fjh at cs.mu.OZ.AU
Fri Oct 12 12:38:13 AEST 2001


On 09-Oct-2001, Ralph Becket <rafe at cs.mu.OZ.AU> wrote:
> I believe that Haskell uses !! to access array members (and possibly
> list members etc. too).

Haskell uses `!' (from the Array module) for arrays and `!!' (from the
standard Prelude) for lists.

> `A !! I' is syntactically more economical than the current Mercury
> convention of using `A ^ elem(I)'.  However, to make substitution of
> the form `A !! I := X' parse would require some work.

If you want to go down that path, another possible alternative would be
to use '{}' instead of 'elem', i.e.

	A^{I}

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  | "... it seems to me that 15 years of
The University of Melbourne         | email is plenty for one lifetime."
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- Prof. Donald E. Knuth
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions:          mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------



More information about the developers mailing list