-
Notifications
You must be signed in to change notification settings - Fork 842
Update tutorial script to include immutability and pipelines #2129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be worth demonstrating:
List.filter isOdd >> List.map (square >> addOne)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feedback!
|
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good feedback.
|
|
||
| /// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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