Update tutorial script to include immutability and pipelines#2129
Update tutorial script to include immutability and pipelines#2129KevinRansom merged 2 commits intodotnet:masterfrom cartermp:update-tutorial
Conversation
| /// use Partial Application and the input and output types of each data processing operation match | ||
| /// the signatures of the functions we're using. | ||
| let squareOddValuesAndAddOneComposition = | ||
| List.filter isOdd >> List.map(fun x -> x |> square |> addOne) |
There was a problem hiding this comment.
May be worth demonstrating:
List.filter isOdd >> List.map (square >> addOne)|
Looks great 👍 |
| printfn "The table of squares from 0 to 99 is:\n%A" sampleTableOfSquares | ||
|
|
||
|
|
||
| /// Values in F# are immutable by default (save for Arrays). They cannot be changed |
There was a problem hiding this comment.
"save for" sounds slightly archaic and might confuse people who only know a little English. Perhaps just remove the "(save for Arrays)", it seems a bit out of place to have the exclusion in the intro senetence any case
|
|
||
| /// The F# pipe operators ('|>', '<|', etc.) and F# composition operators ('>>', '<<') | ||
| /// are used extensively when processing data. These operators are themselves functions | ||
| /// which make use of Partial Application. |
There was a problem hiding this comment.
I think Partial Application need to be capitalized - if anything put it in quotes? Either is OK as long as style in the document is consistent.
There was a problem hiding this comment.
I've capitalized it throughout the document, and also have a link to the section in our docs which explains it.
There was a problem hiding this comment.
Typo in my comment - I meant "need not be capitalized". Sorry. It looks somehow wrong, as if Making It Mysterious
There was a problem hiding this comment.
Okay. I'll send a quick fix.
I've attempted to add two sections: a short one on Immutability, and a longer one that progressively moves a function towards pipelines and function composition. I try to leave out gory details as much as possible, as I think it's best to defer to the documentation there (links are provided).
cc @forki @dsyme