<div dir="ltr">Hi,<br><br>What is the point of using Text here?<br><br>You may rewrite buildList as follows (using &lt;$&gt; from Control.Applicative):<br>buildList = transpose . map (T.split (==&#39;_&#39;)) . T.lines &lt;$&gt; TI.readFile &quot;lin_reg_data.txt&quot;<br>
<br>Regards<br>Sylvain<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/28 Bryce Verdier <span dir="ltr">&lt;<a href="mailto:bryceverdier@gmail.com" target="_blank">bryceverdier@gmail.com</a>&gt;</span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 01/28/2013 11:32 AM, Martin Drautzburg wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Monday, 28. January 2013 19:37:53 Bryce Verdier wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi All,<br>
<br>
At the moment I have a list of lists. The inner list is a coordinate,<br>
like (x,y) but is [x,y] instead. What I would like to do is group all<br>
the x&#39;s into one list, and the y&#39;s into another. I know I can do this<br>
with calling 2 maps on the container, but I would also like to do this<br>
in one iteration.<br>
</blockquote>
Something like this?<br>
        groupMe  = foldl (\[rx,ry] [x,y] -&gt; [x:rx,y:ry]) [[],[]]<br>
<br>
<br>
*Main&gt; groupMe [[1,2],[1,3],[2,3]]<br>
[[2,1,1],[3,3,2]]<br>
</blockquote></div>
Thank you all for your responses. This is what I ultimately went with (pasted below). If anyone would like to share a way to improve this (because I know it can be), please share. I&#39;m still learning. :)<div class="im">
<br>
<br>
module Main where<br>
<br>
import qualified Data.Text as T<br></div>
import qualified <a href="http://Data.Text.IO" target="_blank">Data.Text.IO</a> as TI (readFile)<br>
import Data.List (transpose)<br>
import Numeric.GSL.Fitting.Linear (linear)<br>
import Data.Packed.Vector (fromList)<br>
<br>
buildList :: IO [[T.Text]]<br>
buildList = TI.readFile &quot;lin_reg_data.txt&quot; &gt;&gt;= return . transpose . map (T.split (==&#39;_&#39;)) . T.lines<br>
<br>
main :: IO ()<br>
main = do<br>
    values &lt;- buildList<br>
    let values2 = map (fromList . map (\x -&gt; read (T.unpack x):: Double)) values<br>
    print [linear (head values2) (last values2)]<br>
<br>
<br>
<br>
Warm regards,<br>
Bryce<div class="HOEnZb"><div class="h5"><br>
<br>
______________________________<u></u>_________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/<u></u>mailman/listinfo/beginners</a><br>
</div></div></blockquote></div><br></div>