[m-dev.] diff: random permutations

Fergus Henderson fjh at cs.mu.OZ.AU
Tue Jan 4 08:28:00 AEDT 2000


On 03-Jan-2000, Zoltan Somogyi <zs at cs.mu.OZ.AU> wrote:
> 
> I am committing this now because the new predicate I am adding is used in
> some of the tabling test cases I am about to commit. If anyone wishes to
> make improvements, such as using arrays instead of maps, go ahead.
> 
> library/random.m:
> 	Add a predicate for computing a random permutation of the first N
> 	integers.

Did you consider instead adding
	(1) a function for computing a list of the first N integers
and
	(2) a predicate for computing a random permutation of a list
?

I think those procedures would probably be more generally useful
building blocks.  And if we had both of those, there would be little
advantage in adding their combination.

Note that Haskell has special syntax for (1),
while the C++ STL has a function for (2).

Cheers,
	Fergus.

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3        |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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