csvData1
contains the data in a .csv file. I've created a sequence out of just two of the columns in the spreadsheet
("GIC-ID", "COVERAGE DESCRIPTION")
let mappedSeq1 =
seq { for csvRow in csvData1 do yield (csvRow.[2], csvRow.[5]) }
Looking in the Visual Studio debugger x
winds up being a System.Tuple<string,string>
.
for x in mappedSeq1 do
printfn "%A" x
printfn "%A" x.ToString
Here is the result of executing
for x in mappedSeq1
("GIC-ID", "COVERAGE DESCRIPTION")
<fun:main@28>
I am having difficulty figuring out how to access x
, so I can extract the first element.
You can use pattern matching to deconstruct the tuple
for (a, b) in mappedSeq1 do
// ...
or
for x in mappedSeq1 do
let a, b = x
Alternatively for a 2-tuple you can use the built-in function fst
and snd