19
I am trying to create an additional constructor in F# that does some extra work (i.e. reads a basic csv file) as follows:
type Sheet () =
let rows = new ResizeArray<ResizeArray<String>>()
let mutable width = 0
new(fileName) as this =
Sheet()
then
let lines = System.IO.File.ReadLines fileName
for line in lines do
let cells = line.Split ','
rows.Add(new ResizeArray<String> (cells)) //line 16
if cells.Length > width then width <- cells.Length
but I get the following errors:
Error 1 The namespace or module 'rows' is not defined C:\Users\ga1009\Documents\PhD\cpp\pmi\fsharp\pmi\Csv.fs 16
Error 2 The value or constructor 'width' is not defined C:\Users\ga1009\Documents\PhD\cpp\pmi\fsharp\pmi\Csv.fs 17
Error 3 The value or constructor 'width' is not defined C:\Users\ga1009\Documents\PhD\cpp\pmi\fsharp\pmi\Csv.fs 17
What am I doing wrong?