John Velman [EMAIL PROTECTED] writes:
data Relation a i b = Rel {name::RN, arity::Int, members::(Set [EN])}
Why do you parametrize the data type when you don't use the
parameters? Either do
data Relation = Rel {name::RN, arity::Int, members::Set [EN]}
or
data Relation a i b =
Hi,
I want to implement linear list shuffle in Haskell
(http://c2.com/cgi/wiki?LinearShuffle) and I invented code:
shuffle :: [a] - IO [a]
shuffle [] = return []
shuffle x = do
r - randomRIO (0::Int,length x - 1)
s - shuffle (take r x ++ drop (r+1) x)
return ((x!!r) : s)
This
Gracjan Polak [EMAIL PROTECTED] writes:
shuffle :: [a] - IO [a]
shuffle [] = return []
shuffle x = do
r - randomRIO (0::Int,length x - 1)
s - shuffle (take r x ++ drop (r+1) x)
return ((x!!r) : s)
This algorithm seems not effective, length, take, drop and (!!) are
costly.
Gracjan Polak wrote:
This algorithm seems not effective, length, take, drop and (!!) are
costly. Is there any better way to implement shuffle?
Here is an algorithm known as a perfect-shuffle... I am not too sure of
the efficiency compared to the example you gave, but it builds a tree to
enable
Tomasz Zielonka [EMAIL PROTECTED] writes:
On Fri, Jan 14, 2005 at 09:17:41AM +0100, Gracjan Polak wrote:
This algorithm seems not effective, length, take, drop and (!!) are
costly. Is there any better way to implement shuffle?
You can use mutable arrays (modules Data.Array.MArray,
On Fri, Jan 14, 2005 at 10:17:27AM +0100, Ketil Malde wrote:
Tomasz Zielonka [EMAIL PROTECTED] writes:
On Fri, Jan 14, 2005 at 09:17:41AM +0100, Gracjan Polak wrote:
This algorithm seems not effective, length, take, drop and (!!) are
costly. Is there any better way to implement shuffle?
On Fri, 14 Jan 2005, Gracjan Polak wrote:
I want to implement linear list shuffle in Haskell
(http://c2.com/cgi/wiki?LinearShuffle) and I invented code:
shuffle :: [a] - IO [a]
shuffle [] = return []
shuffle x = do
r - randomRIO (0::Int,length x - 1)
s - shuffle (take r x ++
Please see: http://okmij.org/ftp/Haskell/perfect-shuffle.txt
For an explanation of the algorithm.
Keean.
Ketil Malde wrote:
Tomasz Zielonka [EMAIL PROTECTED] writes:
On Fri, Jan 14, 2005 at 09:17:41AM +0100, Gracjan Polak wrote:
This algorithm seems not effective, length, take, drop and
On Fri, Jan 14, 2005 at 09:17:41AM +0100, Gracjan Polak wrote:
This algorithm seems not effective, length, take, drop and (!!) are
costly. Is there any better way to implement shuffle?
Oleg wrote a great article on implementing the perfect shuffle. with
some sample code.
Tomasz Zielonka [EMAIL PROTECTED] writes:
But is that better, really? IIUC, you will now need to shift the first
part of the string to the right, so it's still a linear operation for
each shuffle.
Perhaps I don't know this particular algorithm, but you can shuffle the
array with linear
Hi,
my name is Fabian Otto.
I'm doing my master in computer science at the technical university of
Berlin (Germany).
I have choosen advanced functional programming (FTFP) [1] as one of my
subjects.
In this course we use opal[2] with some unimplemented features. e.g:
* optional laziness
*
Keean Schupke [EMAIL PROTECTED] writes:
Please see: http://okmij.org/ftp/Haskell/perfect-shuffle.txt
For an explanation of the algorithm.
Right. I was commenting based on the source posted by Gracjan.
(And http://c2.com/cgi/wiki?LinearShuffle contains a variety of
shuffling algorithms).
Henning Thielemann wrote:
Is it a good idea to use IO monad for this plain computation?
It is needed as random number supply.
--
Gracjan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
John Meacham wrote:
Oleg wrote a great article on implementing the perfect shuffle. with
some sample code.
http://okmij.org/ftp/Haskell/misc.html#perfect-shuffle
Thats the kind of answer I was hoping to get :) Thanks.
shuffle could be useful in standard library. At least Python has it. I
Am Freitag, 14. Januar 2005 09:50 schrieb Ketil Malde:
Gracjan Polak [EMAIL PROTECTED] writes:
shuffle :: [a] - IO [a]
shuffle [] = return []
shuffle x = do
r - randomRIO (0::Int,length x - 1)
s - shuffle (take r x ++ drop (r+1) x)
return ((x!!r) : s)
This algorithm
First of all, I don't think any OS shares file pointers between
processes. Otherwise it would be practically impossible to safely use an
inherited filehandle via any API. Different threads using the same
filehandle do share a file pointer (which is a major nuisance in my
experience,
Hi,
my name is Fabian Otto.
Welcome! Feel free to join in the discussion.
--KW 8-)
--
Keith Wansbrough [EMAIL PROTECTED]
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.
___
Haskell-Cafe mailing list
On Fri, 14 Jan 2005, Scott Turner wrote:
The shuffling algorithms mentioned so far are comparable to
insertion/selection sort. I had come up with a shuffler that relates to
quicksort, in that it partitions the input randomly into lists and works
recursively from there. It looks efficient
Recently I had a course on matroids and would like to investigate the
topic a little further. Did anybody write (or start writing) a
Haskell-implementation for matroids?
It would save me some time figuring out if this part of mathematics is
useful for my work ...
Thanks in advance,
Gerhard
Henning Thielemann [EMAIL PROTECTED] writes:
I did some shuffling based on mergesort, that is a list is randomly split
(unzipped) into two lists and the parts are concatenated afterwards. You
must repeat this some times. It even works for infinite lists.
I think it doesn't guarantee equal
Hi,
my name is Fabian Otto.
Heya.
Some other fixtures of the Haskell Community are covered on this page,
http://haskell.org/hawiki/HaskellCommunities.
Two noteworthy ones are the wiki (http://haskell.org/hawiki/) obviously,
and the #haskell IRC channel on irc.freenode.net
On Fri, 14 Jan 2005, Gerhard Navratil wrote:
Recently I had a course on matroids and would like to investigate the
topic a little further. Did anybody write (or start writing) a
Haskell-implementation for matroids?
Do you mean a Matroid type class?
Hello!
Gerhard Navratil wrote:
Recently I had a course on matroids and would like to investigate the
topic a little further. Did anybody write (or start writing) a
Haskell-implementation for matroids?
What is a matroid?
Thanks
Dmitri Pissarenko
--
Dmitri Pissarenko
Software Engineer
Gracjan Polak [EMAIL PROTECTED] wrote:
John Meacham wrote:
Oleg wrote a great article on implementing the perfect
shuffle. with
some sample code.
http://okmij.org/ftp/Haskell/misc.html#perfect-shuffle
Thats the kind of answer I was hoping to get :) Thanks.
shuffle could
On Wed, Jan 12, 2005 at 12:21:25AM +, Aaron Denney wrote:
On 2005-01-11, Simon Marlow [EMAIL PROTECTED] wrote:
On 11 January 2005 14:15, Gracjan Polak wrote:
Simon Marlow wrote:
There's a big lock on File. If you want to do truly concurrent
reading, you can make multiple
25 matches
Mail list logo