2727// F# supports three kinds of comments:
2828
2929// 1. Double-slash comments. These are used in most situations.
30- (* 2. ML-style Block comments. These aren'tuses that often.*)
30+ (* 2. ML-style Block comments. These aren'tused that often.*)
3131/// 3. Triple-slash comments. These are used for documenting functions, types, and so on.
3232/// They will appear as text when you hover over something which is decorated with these comments.
3333///
@@ -68,7 +68,7 @@ module IntegersAndNumbers =
6868 printfn" The table of squares from 0 to 99 is:\n %A " sampleTableOfSquares
6969
7070
71- /// Values in F# are immutable by default (save for Arrays) . They cannot be changed
71+ /// Values in F# are immutable by default. They cannot be changed
7272/// in the course of a program's execution unless explicitly marked as mutable.
7373///
7474/// To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/values/index#why-immutable
@@ -84,11 +84,15 @@ module Immutability =
8484/// A mutable binding. This is required to be able to mutate the value of 'otherNumber'.
8585let mutable otherNumber = 2
8686
87+ printfn" 'otherNumber' is%d " otherNumber
88+
8789// When mutating a value, use '<-' to assign a new value.
8890//
8991// Note that '=' is not the same as this. '=' is used to test equality.
9092 otherNumber<- otherNumber+ 1
9193
94+ printfn" 'otherNumber' changed to be%d " otherNumber
95+
9296
9397/// Much of F# programming consists of defining functions that transform input data to produce
9498/// useful results.
@@ -241,6 +245,8 @@ module PipelinesAndComposition =
241245let squares = List.map square odds
242246let result = List.map addOne squares
243247 result
248+
249+ printfn" processing%A through 'squareOddValuesAndAddOne' produces:%A " numbers( squareOddValuesAndAddOne numbers)
244250
245251/// A shorter way to write 'squareOddValuesAndAddOne' is to nest each
246252/// sub-result into the function calls themselves.
@@ -250,6 +256,8 @@ module PipelinesAndComposition =
250256let squareOddValuesAndAddOneNested values =
251257 List.map addOne( List.map square( List.filter isOdd values))
252258
259+ printfn" processing%A through 'squareOddValuesAndAddOneNested' produces:%A " numbers( squareOddValuesAndAddOneNested numbers)
260+
253261/// A preferred way to write 'squareOddValuesAndAddOne' is to use F# pipe operators.
254262/// This allows you to avoid creating intermediate results, but is much more readable
255263/// than nesting function calls like 'squareOddValuesAndAddOneNested'
@@ -259,6 +267,8 @@ module PipelinesAndComposition =
259267|> List.map square
260268|> List.map addOne
261269
270+ printfn" processing%A through 'squareOddValuesAndAddOnePipeline' produces:%A " numbers( squareOddValuesAndAddOnePipeline numbers)
271+
262272/// You can shorten 'squareOddValuesAndAddOnePipeline' by moving the second `List.map` call
263273/// into the first, using a Lambda Function.
264274///
@@ -269,6 +279,8 @@ module PipelinesAndComposition =
269279|> List.filter isOdd
270280|> List.map( fun x -> x|> square|> addOne)
271281
282+ printfn" processing%A through 'squareOddValuesAndAddOneShorterPipeline' produces:%A " numbers( squareOddValuesAndAddOneShorterPipeline numbers)
283+
272284/// Lastly, you can eliminate the need to explicitly take 'values' in as a parameter by using '>>'
273285/// to compose the two core operations: filtering out even numbers, then squaring and adding one.
274286/// Likewise, the 'fun x -> ...' bit of the lambda expression is also not needed, because 'x' is simply
@@ -285,6 +297,8 @@ module PipelinesAndComposition =
285297let squareOddValuesAndAddOneComposition =
286298 List.filter isOdd>> List.map( square>> addOne)
287299
300+ printfn" processing%A through 'squareOddValuesAndAddOneComposition' produces:%A " numbers( squareOddValuesAndAddOneComposition numbers)
301+
288302
289303/// Lists are ordered, immutable, singly-linked lists. They are eager in their evaluation.
290304///
@@ -826,7 +840,7 @@ module UnitsOfMeasure =
826840
827841
828842/// Classes are a way of defining new object types in F#, and support standard Object-oriented constructs.
829- ///Classes can have a variety of members (methods, properties, events, etc.)
843+ ///They can have a variety of members (methods, properties, events, etc.)
830844///
831845/// To learn more about Classes, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/classes
832846///
@@ -864,7 +878,7 @@ module DefiningClasses =
864878
865879
866880/// Generic classes allow types to be defined with respect to a set of type parameters.
867- /// In thefollowiung , 'T is the type parameter for the class.
881+ /// In thefollowing , 'T is the type parameter for the class.
868882///
869883/// To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/generics/
870884module DefiningGenericClasses =
@@ -895,7 +909,7 @@ module DefiningGenericClasses =
895909/// Object types and object expressions can implement interfaces.
896910///
897911/// To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/interfaces
898- module ImplementingInterfaces =
912+ module ImplementingInterfaces =
899913
900914/// This is a type that implements IDisposable.
901915type ReadFile () =
@@ -921,7 +935,7 @@ module ImplementingInterfaces =
921935/// you use some functions for parallel processing over arrays.
922936///
923937/// To learn more, see: https://msdn.microsoft.com/en-us/visualfsharpdocs/conceptual/array.parallel-module-%5Bfsharp%5D
924- module ParallelArrayProgramming =
938+ module ParallelArrayProgramming =
925939
926940/// First, an array of inputs.
927941let oneBigArray = [| 0 .. 100000 |]
@@ -941,10 +955,10 @@ module ParallelArrayProgramming =
941955
942956
943957
944- /// Events are a common idiom for .NET programming.
958+ /// Events are a common idiom for .NET programming, especially with WinForms or WPF applications .
945959///
946960/// To learn more, see: https://docs.microsoft.com/en-us/dotnet/articles/fsharp/language-reference/members/events
947- module Events =
961+ module Events =
948962
949963/// First, create instance of Event object that consists of subscription point (event.Publish) and event trigger (event.Trigger).
950964let simpleEvent = new Event< int>()