-2

Read from file those lines and make a list like this

 2010‐04‐16,130.68,132.17,130.25,130.63,9546200,130.63
 2010‐04‐15,130.53,131.14,130.19,130.89,6425300,130.89   

List [ "2010‐04‐16","130.68,132.17","130.25","130.63","9546200","130.63"]

how i can make this with take predicate ? or any other predicates

NaFa8
  • 13
  • 6

1 Answers1

0

I could do something like this using Data.List API:

import Data.List

split :: Eq a => a -> [a] -> [[a]]
split delim = map (dropWhile (== delim)) . groupBy (\_ c -> c /= delim)

The output with one of your input strings will be:

Prelude Data.List> split ',' "20100416,130.68,132.17,130.25,130.63,9546200,130.63"
["20100416","130.68","132.17","130.25","130.63","9546200","130.63"]

HTH...

bmk
  • 1,548
  • 9
  • 17