4 Days of F# in NYC!

Get 4 days of intensive F# trainings in New York by attending the Fast Track to F# course immediatelly followed by two days of Progressive F# tutorials with two tracks of hands-on tutorials.

As a limited offer, you can get a free ticket for Progressive F# tutorials, when you sign up for the Fast Track to F# training. Contact us for more details!

Start reading now!

Written by Tomas Petricek with Jon Skeet. Order from Manning or go to Amazon.com, Amazon.co.uk or your favorite book store.

MSDN Articles

The following MSDN sections were written as companion to Real-World Functional Programming. The first chapter is loosely based on chapters 1-3 of the book.

  1. Functional Programming Intro
  2. Server-Side Programming
  3. Client-Side Applications
  4. Numerical Computing
  5. Building Data-Driven Webs
  6. Visualizing Data

Section 4 was written by Yin Zhu and the remaining sections were written by Tomas Petricek.

Errata

I tried to minimize the number of errors in the book as hard as I could. However, some errors are (unfortunately!) inevitable. This page contains the list of known issues. If you spot an issue that isn’t listed on this page, please let me know either using the book forum or send me an email to tomas@tomasp.net.

Chapter 3

  • Page 65, first paragraph There is a typo in the following sentence: “Rather than
    adding the method to the Type<T1, T2> class from listing 3.7, we implement it as an extension method.”
    The name of the class isn’t Type<T1, T2>, but should instead be Tuple<T1, T2>.
  • Page 68, Section 3.3, second paragraph There is a confusing grammar error. The sentence “The type that represents functional lists is either an empty or is composed …” should be “The type that represents functional lists is either an empty list or is composed …”.
  • Page 78, Listing 3.18 The pattern hd::tail should instead be head::tail, because the code uses the head name later on:
    match list with
    | [] -> init
    | head::tail ->
        let resultRest = aggregateList op init tail
        op resultRest head

Chapter 4

  • Page 83, Listing 4.2 On the third line of the listing I use a function List.ofseq,
    which is a wrong name. The correct name of the function is List.ofSeq (with uppercase “S”). The line should look like this:

    let cells = List.ofSeq(csvLines.Split(','))
  • Page 101, Listing 4.11 When calling MeasureString, we give it lbl
    value as the first argument, but this value isn’t declared anywhere. It should be the title parameter instead:

    let size = gr.MeasureString(title, fnt)

Chapter 5

  • Page 105 (introduction for Part 2): There is a repeated sentence: “In part 2 we’ll review all the basic functional features that make it possible to write the first version of the program.”
  • There is an additional word “them” in the last sentence of section 5.4.3. “We’ll talk about generic functions in detail them later, but for now…”

Chapter 6

  • Page 155 The last line of the second inline code example is missing a closing
    parenthesis “)”. It is the example that shows how to use map function instead of the
    inner matchparameter instead. The line should be:

    | Some(first) -> readInput() |> Option.map (fun second -> first + second)
  • Page 159 In Listing 6.15, in the left column, the second line is
    match opt with, but it should be match input with.

Chapter 9

  • Page 241 The last line on the page says “We can break the >NET rules when…”. The correct version should be of course “.NET”.
  • Page 248, Listing 9.14 The second line from the end of the listing shows
    a wrong F# Interactive output. The listing shows Client: John Doe, q=16, but the
    actual output should be Client: John Doe, loan coefficient: 16
  • Page 251, second paragraph A sentence in the paragrpah says “At this point, you can choose which style to follow: an imperative one with some mutable types, or a purely functional one where everything is mutable.” The emphasized word should be immutable.
  • Page 257, first paragraph A description of the previous listing: “The next step is
    to invoke the Deflate method (1)” refers mistakenly to the bullet (1). It should refer to the bullet (2) instead.

Chapter 10

  • Page 272, Listing 10.9 In the body of the map function, the last
    line (map' f list []) should be indented one level less (to match with the let rec
    definition).
  • Page 276, first paragraph below listing 10.12 A description says “… which is similar to List.int that we discussed in listing 10.2.” The List.int should be List.init.

Chapter 11

  • Page 311, Listing 11.22 The text below the listing says “To specify what should be displayed, we set the DataMember property to the name…”. The name of the property should be DisplayMember (the listing itself is correct).

Chapter 12

  • Page 323, last paragraph There is an additional “is” word in the sentence: “We do this is because the sequence of random colors….. “

Chapter 13

  • Page 369, second paragraph from the end In the sentence “In this section, we’ve seen how to get a list of regions that we want to further study.” the last two words should be switched, so that it reads better.
  • Page 380, Listing 13.9 The last two lines of the listing use incorrect names of values (declared earlier). The names should be names and dataArray instead of
    namesVert and tableArr. The correct version is:

    worksheet.Range("B3", "B" + endColumn).Value2

Chapter 14

  • Page 387, Listing 14.3 There is a mismatch in the C# and F# version of the code that is compared in the listing. The F# version counts primes from 1,000,000 to 3,000,000, while the C# version only between 1,000,000 and 2,000,000.

Chapter 16

  • Page 477, first paragraph There are redundant words in the first sentence:
    “All we have to do is to add the following single line before the line that last line that runs the recursion”. The redundant bit should be deleted.