F# Not Working After Visual Studio Update (FSC OK)
I am unable to run the following example:
"Cannot execute text selection: The value, constructor, namespace or type 'distinct' is not defined (using built-in F# compiler)"
What am I missing?
LinqPad generates the following error message:
// 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|]
"Cannot execute text selection: The value, constructor, namespace or type 'distinct' is not defined (using built-in F# compiler)"
What am I missing?
Comments
http://www.linqpad.net/download.aspx#beta
If it still doesn't work, try adding a reference to the latest version of FSharp.Core.dll (which contains the .distinct method).