[Haskell-cafe] [ANN] random-shuffle package

Manlio Perillo manlio_perillo at libero.it
Thu Mar 19 12:21:16 EDT 2009


Max Rabkin ha scritto:
> On Thu, Mar 19, 2009 at 4:41 PM, Manlio Perillo
> <manlio_perillo at libero.it> wrote:
>> However, in this case, the package name should be changed.
>> I'm not sure it is a good idea to release a package that implements only one
>> function (but I may be wrong).
> 
> Personally, I think that there is little harm in releasing a package
> if it does something useful in a not-totally-broken way. Especially if
> you plan to extend it.
> 

Ok, I will add the package on Hackage, thanks.


One last thing.

Yitzchak Gale kindly posted an example with the implementation of my 
`partition` function:
http://hpaste.org/fastcgi/hpaste.fcgi/view?id=2485
using shuffle'.

Now, I would like to implement a `sample` function, like the one in the 
Python random module:
http://docs.python.org/library/random.html#random.sample

Is an implementation based on shuffle good?
Or a more efficient implementation is possible?

How should be the interface of this sample function?
Should it return the sampled list *and* the original list without the 
sampled elements?
Or it is better to just return the sampled list?


If both partition and sample functions can be implemented efficiently 
using shuffle', then it may be appropriate to add these two functions 
inside the random-shuffle package.



Thanks  Manlio


More information about the Haskell-Cafe mailing list