[Haskell-beginners] List Sorting and I/O
lorenzo.isella at gmail.com
Sun Sep 12 18:59:40 EDT 2010
Thanks to the help I got from the list, I was able to (almost) finish a
script that performs some data postprocessing (and the code is really
Now, there are a few things left.
Consider the lists
bs = [4,5,3,1,5,2,7,2,8,2,2,3,3,5,6,7] and
ms = [2,2,2,2,4,4,4,4,6,6,4,4,4,10,12,14]
Now, I would like to sort bs (and that is easy) and then (since there is
a 1-1 correspondence between the elements in ms and bs) re-order the
elements in ms accordingly i.e. bs would become
and ms [2,4,4,6,4,2,4,4,2,2,4,10,12,4,14].
How can I achieve that?
Finally, I would like to be able to save the two lists as plain text
files (no commas, no brackets).
I tried writeFile+Show, but this saves the lists exactly as printed on
screen (whereas I simply would like a text file showing a column of
numbers when opened by your favorite editor).
More information about the Beginners