<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">So I have a text full of x and y
coordinates in the for x_y new line delimited. Here is the first 3
lines:<br>
68_1<br>
153_16099247764943158<br>
153_775041589<br>
<br>
I'm massaging the data to run a liner regression on it. At the
moment the program I'm writing looks like this (still a work in
progress...):<br>
<br>
module Main where<br>
<br>
import qualified Data.Text as T<br>
import qualified Data.Text.IO as TI<br>
import Numeric.GSL.Fitting.Linear<br>
import Data.Packed.Vector<br>
<br>
buildList :: IO [[T.Text]]<br>
buildList = TI.readFile "lin_reg_data.txt" >>= return . map
(T.split (=='_')) . T.lines<br>
<br>
--main :: IO ()<br>
--main = do<br>
-- values <- buildList<br>
-- let heads = fromList $ map (\x -> read (T.unpack . head $
x):: Double) values<br>
-- let lasts = fromList $ map (\x -> read (T.unpack . last $
x):: Double) values<br>
-- print linear heads lasts<br>
<br>
<br>
I'm just trying to find a way to not iterate over "vaues" twice as
that seems like a waste of computing time to me. Of course any
advice on this would be appreciated.<br>
<br>
Bryce<br>
<br>
<br>
On 01/28/2013 10:42 AM, Ozgur Akgun wrote:<br>
</div>
<blockquote
cite="mid:CALzazPARL9Ei5cE_ETtvn+2Xi9URLwucHmyP11brLZa6gVjYGA@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_extra">Hi,</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On 28 January 2013 18:37, Bryce
Verdier <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:bryceverdier@gmail.com" target="_blank">bryceverdier@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">I know I
can do this with calling 2 maps on the container, but I
would also like to do this in one iteration.</blockquote>
</div>
<div class="gmail_extra"><br>
</div>
As a learning experience, may I suggest you post the code you
would have written with two maps? Then we can try and improve
on that to have only one map.</div>
<div class="gmail_extra">
<br>
</div>
<div class="gmail_extra">Best,</div>
<div class="gmail_extra"><br>
<div><br>
</div>
-- <br>
Ozgur Akgun
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Beginners mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Beginners@haskell.org">Beginners@haskell.org</a>
<a class="moz-txt-link-freetext" href="http://www.haskell.org/mailman/listinfo/beginners">http://www.haskell.org/mailman/listinfo/beginners</a>
</pre>
</blockquote>
<br>
</body>
</html>