<br><font size=2 face="sans-serif">how about this, for wordSize? I used
quickcheck to verify that my wordSize2 is the same as yours.</font>
<br>
<br><font size=2 face="sans-serif">Actually, it's not! if you allow negative
integers in the list, it's not at any rate. (&quot;falsifiable after 50
tries&quot;)</font>
<br>
<br><font size=2 face="sans-serif">I haven't thought through what this
means... if your function isn't quite right, or mine, or it doesn't really
matter.</font>
<br>
<br><font size=2 face="sans-serif">Also I would be curious to see this
quickchecked but not allowing negative integers in the list if someone
can show me how to do that.</font>
<br>
<br><font size=2 face="sans-serif">Also, I commented out intToBinWord because
intToBin isn't in prelude nor in any library I could track down and I'm
not sure what it was supposed to do.</font>
<br>
<br><font size=2 face="sans-serif">thomas.</font>
<br>
<br><font size=2 face="sans-serif">import Data.List</font>
<br><font size=2 face="sans-serif">import Data.Maybe</font>
<br><font size=2 face="sans-serif">import Test.QuickCheck</font>
<br>
<br><font size=2 face="sans-serif">wordSize :: [Int] -&gt; Int</font>
<br><font size=2 face="sans-serif">wordSize xs = head (dropWhile (&lt;(length
xs)) $ iterate (*2) 8)</font>
<br>
<br><font size=2 face="sans-serif">wordSize2 :: [Int] -&gt; Int</font>
<br><font size=2 face="sans-serif">wordSize2 xs = fromJust $ find (&gt;(length
xs)) $ iterate (*2) 8</font>
<br>
<br><font size=2 face="sans-serif">main = quickCheck $ \xs -&gt; wordSize2
( xs :: [Int]) == wordSize xs</font>
<br>
<br><font size=2 face="sans-serif">{-</font>
<br><font size=2 face="sans-serif">intToBinWord :: Int -&gt; [Int]</font>
<br><font size=2 face="sans-serif">intToBinWord n = reverse (take elements
(xs ++ repeat 0))</font>
<br><font size=2 face="sans-serif">&nbsp; where</font>
<br><font size=2 face="sans-serif">&nbsp; xs = reverse (intToBin n)</font>
<br><font size=2 face="sans-serif">&nbsp; elements = wordSize xs</font>
<br><font size=2 face="sans-serif">-}</font>
<br>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>PR Stanley &lt;prstanley@ntlworld.com&gt;</b>
</font>
<br><font size=1 face="sans-serif">Sent by: haskell-cafe-bounces@haskell.org</font>
<p><font size=1 face="sans-serif">10/12/2007 03:10 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">haskell-cafe@haskell.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[Haskell-cafe] more functions to evaluate</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Hi folks<br>
Any comments and/or criticisms no matter how trivial on the following please:<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
wordSize :: [Int] -&gt; Int<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
wordSize xs = head (dropWhile (&lt;(length xs)) $ iterate (*2) 8)<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
intToBinWord :: Int -&gt; [Int]<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
intToBinWord n = reverse (take elements (xs ++ repeat 0))<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; where<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; xs = reverse (intToBin n)<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; elements = wordSize xs<br>
<br>
Thanks, Paul<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
Haskell-Cafe@haskell.org<br>
http://www.haskell.org/mailman/listinfo/haskell-cafe<br>
</font></tt>
<br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">---</span><br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">This e-mail may contain confidential and/or privileged information. If you </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">are not the intended recipient (or have received this e-mail in error) </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">please notify the sender immediately and destroy this e-mail. Any </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">unauthorized copying, disclosure or distribution of the material in this </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">e-mail is strictly forbidden.</span><br>