<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I am playing with Test.Hspec and Test.QuickCheck and I am traying to
implement KMeans algorithm as a training. I use very simple
representation of vectors: <tt>type LVector=[Double]</tt><br>
<br>
I have no problems to write testcases with some concreate examples
of input and expected output:<br>
<tt><br>
</tt><tt>it "sum of vectors is computed field by field" $ do </tt><tt><br>
</tt><tt> (<b>sumVect</b> [[1.0, 2.0], [3.0, 4.0], [4, 5]])
`shouldBe` [8.0, 11.0] </tt><tt><br>
</tt><br>
or simple properties based tests:<br>
<tt><br>
</tt><tt>it "zeroVector contains just zeroes" $</tt><tt><br>
</tt><tt> property (\(Positive d) -> [] == filter (/= 0.0)
(</tt><tt><b>zeroVector</b></tt><tt> d) )</tt><br>
<br>
but I get sticked, when I try to create QuickCheck test, for example
for the first case (<b>sumVect</b>). How can I generate list of
lists, where all the included lists are of the same length?<br>
<br>
Link for some tutorial *) can be, I believe, enough but I would be
glad for any help.<br>
<br>
Thanks<br>
Ondra @satai Nekola<br>
<a class="moz-txt-link-abbreviated" href="mailto:ondra@nekola.cz">ondra@nekola.cz</a><br>
<br>
*) Maybe I have not trained my google good enough yet, but lack of
tutorials describing more than the most basic usecase is probably
the most problematic point in re-learning Haskell so far.<br>
</body>
</html>