fp-in-csharp
所属分类:C/C++基础
开发工具:JavaScript
文件大小:5246KB
下载次数:0
上传日期:2023-01-04 13:05:10
上 传 者:
sh-1993
说明: C语言中的函数编程#
(Functional Programming in C#)
文件列表:
deck (0, 2019-11-13)
deck\deck1.pdf (2150649, 2019-11-13)
deck\deck2.pdf (504374, 2019-11-13)
deck\package.json (433, 2019-11-13)
deck\src (0, 2019-11-13)
deck\src\components (0, 2019-11-13)
deck\src\components\carousel.js (287, 2019-11-13)
deck\src\deck copy.mdx (17163, 2019-11-13)
deck\src\deck1.mdx (16255, 2019-11-13)
deck\src\deck2.mdx (8211, 2019-11-13)
deck\src\deck3.mdx (3998, 2019-11-13)
deck\src\images (0, 2019-11-13)
deck\src\images\applicative_in_picture.png (133968, 2019-11-13)
deck\src\images\bind_regular_vs_elevated_values.png (57446, 2019-11-13)
deck\src\images\changing_value_in_context.png (55720, 2019-11-13)
deck\src\images\changing_value_in_context_magic.png (106439, 2019-11-13)
deck\src\images\changing_value_in_context_nothing.png (34313, 2019-11-13)
deck\src\images\either_circuit_breaking.png (63298, 2019-11-13)
deck\src\images\either_circuit_flow.png (138922, 2019-11-13)
deck\src\images\higher_order_functions.jpeg (52406, 2019-11-13)
deck\src\images\higher_order_functions_diagram.jpeg (12195, 2019-11-13)
deck\src\images\list_effect.png (99558, 2019-11-13)
deck\src\images\map_regular_vs_elevated_values.png (51357, 2019-11-13)
deck\src\images\meme_fp.jpeg (8403, 2019-11-13)
deck\src\images\meme_fp_patterns.jpg (45696, 2019-11-13)
deck\src\images\meme_higher_order_functions.jpeg (48234, 2019-11-13)
deck\src\images\meme_ice_cube_1.jpg (16868, 2019-11-13)
deck\src\images\meme_ice_cube_2.jpeg (6670, 2019-11-13)
deck\src\images\meme_ice_cube_3.jpg (39458, 2019-11-13)
deck\src\images\meme_ice_cube_4.jpg (27295, 2019-11-13)
deck\src\images\meme_ice_cube_5.jpg (85795, 2019-11-13)
deck\src\images\meme_ice_cube_6.jpg (74354, 2019-11-13)
deck\src\images\meme_in_n_out.png (41283, 2019-11-13)
deck\src\images\meme_monads_everywhere.jpeg (45231, 2019-11-13)
deck\src\images\meme_mutating_states.jpg (50948, 2019-11-13)
deck\src\images\option_map.png (302639, 2019-11-13)
deck\src\images\option_to_encode_partial_functions.png (239672, 2019-11-13)
... ...
# Functional Programming in C#
### Run the decks
NOTE: you can use `yarn` or `npm` commands interchangeably but do yourself a favor and install yarn globally `npm i yarn -g` and save some time!
- clone this repo
- `cd deck`
- `yarn install`
- Start deck for Part 1 `yarn run part1`
- Start deck for Part 2 `yarn run part2`
### Export the decks as PDF
- Export deck for Part 1 `yarn run pdf deck1.pdf`
- Export deck for Part 2 `yarn run pdf deck2.pdf`
### Examples
To run each example, move into its respective folder and run `dotnet run`.
#### Part 1
- `examples/Code/FPinCSharp.Example1`
- Employee directory application written in an imperative way
- `examples/Code/FPinCSharp.Example2`
- Fixing Employee directory bugs by avoiding mutation
- `examples/Code/FPinCSharp.Example3`
- Fixing Employee directory bugs caused due to having partial functions and unexpected nulls by utilizing `Option`
#### Part 2
- `examples/Code/FPinCSharp.Example4`
- Leverage `Either` effect to encode application errors in a functional way
- `examples/Code/FPinCSharp.LINQSyntax`
- Introduction to C# LINQ syntax which is a convenient syntax for chaining effectful functions
- `examples/Code/FPinCSharp.Example5`
- Social media profile generation by composing sequential Tasks using a Monadic approach
- `examples/Code/FPinCSharp.Example6`
- Social media profile generation by composing parallel Tasks using an Applicative approach
- `examples/Code/FPinCSharp.Traversables`
- Working with lists of elevated values and using `Sequence` and `Traverse` functions
- `examples/Code/FPinCSharp.Example7`
- Generating many Social media profiles in parallel leveraging `Sequence` from Traversables, the whole request fails if any fail
- `examples/Code/FPinCSharp.Example8`
- Generating many Social media profiles in parallel and ignoring the failed requests and collected the successfully results only
### What to expect in Part 3
- More Advanced, real world examples of working with `Try`, `TryAsync`, `Traversables`
- `examples/Code/FPinCSharp.Traversables`
- `examples/Code/FPinCSharp.Example8`
- Pattern Matching
- Pattern matching in C#
- Functional ways of application development using Pattern Matching (creating your own DSL for making a small metrics service)
- `examples/LINQPad/pattern-matching-vs-polymorphism`
- Limitations of Pattern Matching and Problems of using PM as a replacement to Polymorphism in C#
- Ad-Hoc Polymorphism and C#
- Types of polymorphism
- `examples/LINQPad/subtype-polymorhism.linq`
- Ad-Hoc Polymorphism
- `examples/LINQPad/ad-hoc-polymorphism.linq`
- `examples/LINQPad/ad-hoc-polymorhism-using-extention-methods-in-csharp.linq`
- Extension methods as the closest thing in C# for achieving Ad-Hoc Polymorphism
- Higher Kinded Types
- Lenses and ways of working with nested complex immutable types
- `examples/Code/FPinCSharp.Lenses`
- `examples/Code/FPinCSharp.ImmutableTypes`
- FP things to avoid in C#
- Pattern Matching as a replacement for Polymorphism in C#
- Currying
- Currying is great if a language has first class support for it
- Since in C# almost everything needs to be statically typed, you end up having very complex type signatures (`Func>`) which in my opinion, in many cases makes them less practical in C#
- There will be times that we cannot avoid them (e.g Apply functions)
- Recursion
- How to write stack safe tail recursive functions using trampolining technique (fixing our not so stack safe Loop function in Examples 1-4)
近期下载者:
相关文件:
收藏者: