Wednesday, March 23, 2011

Seq.generate_using is MIA in F#.

Hi, I'm trying to use the Seq.generate_using function, but, unfortunately, I don't seem to be able to find it. I thought it would be living here:

Microsoft.FSharp.Collections.Seq.generate_using

But, no. I get the below error. Help?

C:\Users\Owner\Documents\Visual Studio 2008\Projects\fsharp1\Program.fs(54,63): error FS0039: The value, constructor, namespace or type 'generate_using' is not defined. A construct with this name was found in FSharp.PowerPack.dll, which contains some modules and types that were implicitly referenced in some previous versions of F#. You may need to add an explicit reference to this DLL in order to compile this code.

From stackoverflow
  • According to the Sept 2008 CTP Release Notes:

    The F# library is split into two components. FSharp.Core.dll: Contains the core F# libraries, which will be stabilized and versioned infrequently. FSharp.PowerPack.dll: Contains additional useful F# libraries and tools which will version more frequently, and allow continued innovation on top of the core F# language and libraries.

    Some methods in the Seq module were moved into the FSharp.PowerPack assembly, so you can only get those methods by doing the following:

    • If you're using Visual Studio, open your Solution Explorer, right-click on the project file, choose "Add Reference", and add "FSharp.PowerPack.dll".

    • If you're using a script file or fsi, then type #r "FSharp.PowerPack";; to load the assembly.

    Now you should be able to call Seq.generate_using.

  • The #r "FSharp.PowerPack";; works for me but the addition of PowerPack to my solution does not. I am trying to use HashSet<>.

    Hossein HAERI : Using the answer provided in the following link by dsyme, I know that I've been missing the fact that FSI works (mostly) independent of the project: http://cs.hubfs.net/forums/thread/7031.aspx That is, although I had added FSharp.PowerPack.dll to my project, FSI was still rejecting the following line: let bestPics = new HashSet() whereas my project was successfully built.

0 comments:

Post a Comment