Susan Harkins (399) [Avatar] Offline
#1
Please post errors found in Functional Programming in C# here. If necessary, we'll publish a comprehensive list for everyone's convenience. Thank you!

Susan Harkins
Errata Editor
516926 (1) [Avatar] Offline
#2
Hi,

First of all, congratulations to the team that brought this book out - it's excellent!

I just started reading the book and noticed a minor error in section 3.1.2 How informative is a signature?.
In the paragraph that starts with 'Take a minute and see ...', a portion of a sentence reads, 'The function returns a list of T's as input; ...' when it should actually read 'The function returns a list of Ts as output; ...'.

I'll try and report any more that I find.

Thank you
152361 (1) [Avatar] Offline
#3
In the page 21 there is content duplicated, the same text appears in a paragraph and as page note

and use it to perform a task or to compute a value. [7] This is perhaps the most common pattern for HOFs, and it’s sometimes referred to as inversion of control: the caller of the HOF decides what to do by supplying a function, and the callee decides when to do it by invoking the given function.

7This is perhaps the most common pattern for HOFs, and it’s sometimes referred to as inversion of control: the caller of the HOF decides what to do by supplying a function, and the function decides when to do it by invoking the given function.
Enrico Buonanno (94) [Avatar] Offline
#4
On page 153

public static Func<T2, T3, R> Apply<T1, T2, T3, R> 
(this Func<T1, T2, T3, R> f, T1 t1) 
   => (t2, t3) => func(t1, t2, t3); 


should be:

public static Func<T2, T3, R> Apply<T1, T2, T3, R> 
(this Func<T1, T2, T3, R> f, T1 t1) 
   => (t2, t3) => f(t1, t2, t3);


the function passed as argument is called `f`, so in the implementation it should also be `f`, but is erroneously referred to as `func` in the text
Brother Bill (16) [Avatar] Offline
#5
Chapter 4.2 ForEach&lt;T&gt; won't compile (with fix)
On page 86, this code won't compile.

  public static IEnumerable<Unit> ForEach<T>(
      this IEnumerable<T> ts,
      Action<T> action) =>
      ts.Map(action.ToFunc()).ToImmutableList();


The error is on line 4 with message:
Cannot implicitly convert type 'System.Collections.Immutable.ImmutableList<System.ValueTuple>' to 'System.Collections.Generic.IEnumerable<LanguageExt.Unit>'
Cannot convert expression type 'System.Collections.Immutable.ImmutableList<()>' to return type 'System.Collections.Generic.IEnumerabli<LanguageExt.Unit>'

The cause was leaving out this line:
using Unit = System.ValueTuple;


Since it bit me for about a half hour, I figured that I would pass it on for your benefit.
Brother Bill (16) [Avatar] Offline
#6
Typo on page 87
Near top of page:
public static Option<Unit> ForEach<T>
    (this Option<T> opt, Action<T> action) 
    => Map(opt, action.ToFunc());


It should be:
public static Option<Unit> ForEach<T>
    (this Option<T> opt, Action<T> action) 
    => opt.Map(action.ToFunc());
MrYossu (7) [Avatar] Offline
#7
Small error, but repeated many times: When referring to a generic type, usually T, pluralising it should not include an apostrophe.

Therefore, the following text (page 81) is incorrect...

Map maps a list of T's to a list of R's by applying...

...and should read...

Map maps a list of Ts to a list of Rs by applying...

Not a major issue, but annoying to those of us who were taught correct grammar!

The same applies to abbreviations by the way. Haven't seen any in this book, but it's common to see "I bought two CD's today" which is incorrect for the same reason. Should just be "CDs"

End of rant smilie
157088 (1) [Avatar] Offline
#8
Hi Enrico,

you wrote a greate book!


I found a small issue on Page 69 in Listing 3.5:

public static Option.Some<T> Some<T>(T value) => new Option.Some<T>(value);


should be

public static Option<T> Some<T>(T value) => new Option.Some<T>(value);



Best Regards
Robert
Enrico Buonanno (94) [Avatar] Offline
#9
Typo on page 87
Brother Bill wrote:Near top of page:
public static Option<Unit> ForEach<T>
    (this Option<T> opt, Action<T> action) 
    => Map(opt, action.ToFunc());


It should be:
public static Option<Unit> ForEach<T>
    (this Option<T> opt, Action<T> action) 
    => opt.Map(action.ToFunc());


Strictly speaking, this is not an error, since both are equivalent (extension methods can be invoked as normal methods as well... )

However, I agree that I use the extension method syntax in the book (I find it more intuitive), so that it would be more consistent to change the next edition as suggested here
Enrico Buonanno (94) [Avatar] Offline
#10
157088 wrote:
I found a small issue on Page 69 in Listing 3.5:

public static Option.Some<T> Some<T>(T value) => new Option.Some<T>(value);


should be

public static Option<T> Some<T>(T value) => new Option.Some<T>(value);



Robert


Correct, thanks!
Susan Harkins (399) [Avatar] Offline
#11
"Small error, but repeated many times: When referring to a generic type, usually T, pluralising it should not include an apostrophe."

This is really more about style than grammar. While, I wasn't the copyeditor, I can offer an opinion. I reviewed the section in question and the author mentions a collection name, ts -- lower case. It's possible that the copyeditor chose to add the apostrophe to avoid confusion between ts and Ts. Doing so is allowable. But, I'm just guessing.

Susan Harkins
Errata Editor
Susan Harkins (399) [Avatar] Offline
#12
An updated errata list for Functional Programming in C# is available at https://manning-content.s3.amazonaws.com/download/e/c4f9ace-37af-4e6d-a598-782e97f8e407/Buonano_FuctionalProgramminginCSharp_err2.html. Thank you for participating in the collection process. Your contributions are a great help to us and other readers.

Regards,
Susan Harkins
Errata Editor