Home

F# Not Working After Visual Studio Update (FSC OK)

I am unable to run the following example:

// https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/array.distinct['t]-function-[fsharp]#example

module lperror =

open System

let binary n =
let rec generateBinary n =
if (n / 2 = 0) then [n]
else (n % 2) :: generateBinary (n / 2)
generateBinary n |> List.rev |> Array.ofList

printfn "%A" (binary 1024)

let resultArray = Array.distinct (binary 1024)
printfn "%A" resultArray

// Expected Output
// [|1; 0; 0; 0; 0; 0; 0; 0; 0; 0; 0|]
// [|1; 0|]
LinqPad generates the following error message:
"Cannot execute text selection: The value, constructor, namespace or type 'distinct' is not defined (using built-in F# compiler)"

What am I missing?

Comments

Sign In or Register to comment.