I am a student learning F# and at the moment am attempting to output a list to a file created from analysis through a clustering algorithm. I think I am close but I am getting the error message from the second elem: "The type 'int list' is not compatible with any of the types byte,int16,int32,int64,sbyte,uint16,uint32,uint64,nativeint,unativeint, arising from the use of a printf-style format string" Here is my code:
let printNumbersToFile fileName =
use file = System.IO.File.CreateText(fileName)
clusteredIds
|> List.iter (fun elem -> fprintf file "%d " elem)
fprintfn file ""
printNumbersToFile "C:\Users\Jessica\Desktop\CTU Stuff\Dissertation\Programs For Dissertation\Fsharp\DensityClustering\Test.csv"
Any help would be greatly appreciated. Thank you in advance.
file.Close()
at the end - or better, if this is in a function, you can writeuse file = ...
. See: msdn.microsoft.com/en-us/library/dd233240.aspx - Tomas Petricek