Search code examples
f#excel-dna

F# |> (Pipeforward) 'block following let is unfinished' error


Would someone please help me understand why the code below gives me the error 'Block following let is unfinished. Expected an Expression'? The value of x is expected to be a string list and that is how F# sees it. So why does x not become a string list for use later in the function?

let fxProper (str : string) (values : obj[,]) =
    let x = 
        values
        |> Seq.cast<obj> 
        |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
        |> Seq.map string 
        |> Seq.toList

Solution

  • You need to do something with the x value you just set

    let fxProper (str : string) (values : obj[,]) =
        let x = 
            values
            |> Seq.cast<obj> 
            |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
            |> Seq.map string 
            |> Seq.toList
        x
    

    should work.

    This

      let fxProper (str : string) (values : obj[,]) =
                values
                |> Seq.cast<obj> 
                |> Seq.filter (fun x -> not (x :? ExcelEmpty)) 
                |> Seq.map string 
                |> Seq.toList
    

    should work as well.