Or, Visual Studio > (name of the program) > Solution Explorer > References > (right-click) Add Reference > .NET > FSharp.PowerPack > OK.

By on 10/11/2008 10:35 AM ()

The String.split function is now in FSharp.PowerPack.dll so you need to put the #r "FSharp.PowerPack.dll" command before your script. Alteratively you use the native .NET methods for splitting a string, so you could write:

1
2
3
4
5
6
let wordCount (text:string) =
    let words = text.Split([|' '|])
    let wordSet = Set.of_array words
    let nWords = words.Length
    let nDups = words.Length - wordSet.Count
    (nWords,nDups)

Note you need a type anontation on the text parameter now so you can use its member methods.

Cheers,
Rob

By on 9/20/2008 9:59 PM ()

Thanks Rob, that fixes the problem.

I wonder if there are other places where reality diverges from the book...

I checked in the online updates/errata for the book, but could not find any mention of this specific problem.

Anyway, onward to Ch. 3.

By on 9/21/2008 6:27 AM ()

I believe there are a few know issues with the book, but this was actually correct at the time of going to press, the problem was caused by CTP release. If a good first step in fixing any problem is to add a reference the "FSharp.PowerPack.dll" which was reference by default before the CTP.

Cheers,
Rob

By on 9/21/2008 7:52 AM ()

I've updated the www.expert-fsharp.com website to point out that you have to reference FSharp.PowerPack.dll - thanks!

I've also added some more minor entries to the errata.

A couple of constructs used in the book will raise deprecation warnings, but the warnings will indicte the replacement names. Those haven't yet been noted in the errata.

Please let us know if there are any further updates we need to make.

thanks

don

By on 9/21/2008 10:47 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper