Hey, I wanted to read a CSV file and convert it into a list of tuples and I come up with this:
"./pairs.csv"
|> Path.expand(__DIR__)
|> File.stream!
|> Stream.drop(1)
|> Stream.map(&String.trim(&1, "\n"))
|> Stream.map(&String.split(&1, ","))
|> Enum.map(fn(pairs) -> {elem(Float.parse(List.first(pairs)), 0), elem(Float.parse(List.last(pairs)), 0)} end)
Is there any simpler and robust way to do this? How about the performance how can I improve it?