[m-dev.] for review: improvements for record syntax
Simon Taylor
stayl at cs.mu.OZ.AU
Thu Dec 7 01:40:51 AEDT 2000
Fergus wrote:
> Richard O'Keefe's guidelines about argument ordering, which are
> explained in his book The Craft of Prolog, say that collection types
> such as array should precede indexes. The reason for this is to be
> consistent with the suggested ordering for in/out mode arguments,
> namely that in mode arguments should precede out mode arguments.
> The point here is that you might want to define a mode of `elem'
> that nondeterministically produces all the elements of the
> array:
> ...
This doesn't matter so much if the non-standard ordering
is not visible in calls to the function.
> P.S. Will the new field access syntax allow examples like that?
> E.g. can I write `some [Index] (Array ^ elem(Index) > Index)'
> and have it `elem' nondeterministically produce the corresponding
> indices and elements of the array?
That will work. The transformation into ordinary function application
doesn't care about the modes or determinism of the function.
This is probably a case where different code for different modes
is needed -- I don't think it's possible to write a version of `elem'
which can non-deterministically return the elements of the array
without ruining the performance of the normal `elem(in, in) = out'
mode.
Simon.
--------------------------------------------------------------------------
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