F# selecting a single value in an array -
i diving f# first time, trying follow luca's example found here. doing pretty parsing input file, stuck in trying filter sequence based on value of 1 value in array. here
let filestream = new filestream(path,filemode.open,fileaccess.read) let streamreader = new streamreader(filestream) let contents = streamreader.readtoend() let cleancontents = contents.split([|'\n'|]) |> seq.map(fun line -> line.split([|'\t'|])) |> seq.filter(fun values -> values |> seq.length = 6)
when try , add this,
|> seq.filter(fun values -> values |> values[0].length = 8)
i compile error. want check 1st column in sequence has 8 characters only, no more or less. in advance.
the issue forward piping "values". makes no sense.
|> seq.filter(fun values -> values[0].length = 8)
should work.
(update: missed comments question , not ildjarn answered first in comment)
Comments
Post a Comment