<br><br><div><span class="gmail_quote">On 16/06/07, <b class="gmail_sendername">Jim Burton</b> <<a href="mailto:email@example.com">firstname.lastname@example.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Sebastian Sylvan wrote:<br>><br>> A sorry, I thought the delimiter was a line delimiter. I'm trying to get to<br>> that fusion goodness by using built-in functions as much as possible...<br>><br>> How about this one:
<br>><br>> clean del = B.map ( B.filter (/='\n') ) . B.groupBy (\x y -> (x,y) /=<br>> (del,'\n'))<br>><br>> That groupBy will group it into groups which don't have the delimiter<br>> followed by a newline in them (which is the sequence your rows end with),
<br>> then it filters out newlines in each row. You might want to filter out<br>> spaces first (if there are any) so that you don't get a space between the<br>> delimiter and newline at the end...<br>><br>
><br>I think you still need unlines after that so is the time complexity<br>different to the<br><br>unlines . foldr (function including `last') . lines<br><br>in my first post? Or is it better for another reason, such as "fusion
<br>goodness"?<br></blockquote></div><br><br>Benchmark it I guess :-)<br>Both versions use a non-bytestring recursive functions (the outer B.map should just be a straight map, and yours use a foldr), which may mess fusion up... Not sure what would happe here...
<br>I don't have a Haskell compiler at this computer so I can't try anything out...<br><br clear="all"><br>-- <br>Sebastian Sylvan<br>+44(0)7857-300802<br>UIN: 44640862