This project is read-only.
1

Resolved

Expert F# examples not working

description

Hello,
 
I just purchased the book Expert F#, installed the latest Visual Studio 2010 release (10.0.21006.1 B2Rel), and downloaded the code sample for the first F# program in chapter 2. Unfortunately, it doesn't run because it cannot find String.split(). The error points me to the FSharp.PowerPack. I downloaded the power pack & Visual Studio says that the assembly must be recompiled to work with this version of Visual Studio. So, I downloaded the Power Pack source code to compile, and I receive an error that "unmanaged" is an unexpected identifier.
 
Thus, I'm a bit stuck. Can you point me in the right direction?
 
Thanks,
Mike

comments

LukeH wrote Feb 13, 2010 at 9:57 PM

Hi Mike -

Sure thing. This PowerPack release will work with the February 2010 and later releases of F#. You can use either VS2010 RC, or the February 2010 F# CTP. See http://msdn.microsoft.com/en-us/fsharp/cc835251.aspx for download details. The Beta2 release you mention is older, and there is a corresponding F# PowerPack available for that release but I recommend moving to the newer F#.

As a note: Most of the samples from the Expert F# book do not actually require the F# PowerPack, and the first sample can be written without the PowerPack as this:

let wordCount (text :string) =
let words = text.Split [|' '|]
let wordSet = Set.ofArray words
let nWords = words.Length
let nDups = words.Length - wordSet.Count
(nWords, nDups)
let showWordCount text =
let nWords, nDups = wordCount text
printfn "--> %d words in the text" nWords
printfn "--> %d duplicate words" nDups
Thanks,
Luke

wrote Feb 13, 2010 at 9:59 PM

wrote Jan 24, 2012 at 5:26 PM

wrote Feb 22, 2013 at 12:25 AM

wrote May 16, 2013 at 11:44 AM

wrote May 16, 2013 at 11:44 AM

wrote Jun 14, 2013 at 8:24 AM