Expert Functional Programming and LINQ via C#

LinqViaCSharp7_Dixin_DesktopDesign.fw2.fw

Keywords

.NET Core, .NET Framework, C# 7.x, Functional Programming, Lambda Calculus, Category Theory, LINQ, LINQ to Objects, LINQto XML, Parallel LINQ, LINQ to Entities, Entity Framework Core, Entity Framework.

Abstract

This is a latest, in-depth, cross-platform tutorial on functional programming and LINQ programming via C# 7.0 language. It discusses real world development to underlying mathematics theories. It covers both .NET Framework (for Windows development) and .NET Core (for Linux, Mac, and Windows development).

C# is an open source, cross-platform language from Microsoft, and LINQ is the built-in functional data query capabilities of the language, working with API sets provided by .NET libraries. This entire tutorial is based on the latest language and frameworks. It covers C#’s functional features and functional programming aspects, and the detailed usage and internal mechanisms of mainstream LINQ technologies for different data domains, including LINQ to Objects, Parallel LINQ, LINQ to XML, and LINQ to Entities. It also demystifies the underlying quintessential theories of functional programming and LINQ, including Lambda Calculus and Category Theory.

Acclaim

The following are the acclaim from Microsoft:

  • “This book explains practical and in-depth material clearly, concisely and accurately to the areas of the C# language, functional programming, and LINQ on .NET Framework and .NET Core. This is a great book for anyone wanting to understand the whys and hows behind these important technologies.”
    Samer Boshra
    Microsoft Principal Software Engineering Manager
  • “This book covers LINQ and underlying functional programming concepts comprehensively. It employs tutorials and examples to illustrate various features and applications. The underlying theory is thoroughly explained as well to strengthen your understanding of the topic. Whether you are a beginner or journeyman, you will gain in-depth knowledge of the subject through this book.”
    Alok Parmesh
    Microsoft Senior Software Engineer
  • “This is an excellent book on LINQ as it goes beyond covering how to program with LINQ but articulates the theory behind it and mechanics of the language, a coverage which is not easy to come by. Understanding this level of detail is necessary to program with LINQ to develop first class applications that are efficient and maintainable.”
    Ari Bertan
    Microsoft Senior Software Engineer
  • “This is a great book if you want to learn LINQ and functional programming with C# in depth. You can see Dixin’s deep expertise and feel his obsession for technologies. I started using C# since it was born, but I still learned new things from this book. It is an easy-to-read book, and there are lots of well-picked code examples. I have no doubt that readers will become experts on the topics after reading this book.”
    Paul Lou
    Microsoft Senior Software Engineer
  • “This is a great book for C# developers, it covers both basic C# programming concepts for the beginners new to the .NET world, and C# advanced constructs for experienced .NET programmers. The book is up to date, talks C# 7.0 new language features and demonstrates how you can use them for functional programming. Thanks for the awesome work!”
    Mark Zhou
    Microsoft Senior Software Engineer
  • “This is an excellent in-depth C# functional programming and LINQ book. It explains the latest technology with clear, concise and accurate examples. I would love to encourage everybody who wants to improve their productivity and efficiency of C# programming to have a read of this book.”
    Jacky Gao
    Microsoft Research Software Engineer
  • “Since LINQ has been introduced into .NET Framework, it has been becoming more and more important and powerful for .NET developers. This book greatly breaks down LINQ and functional programming into well-organized pieces, and makes me much more easily understand how to use LINQ and functional programming better than I used to. I highly recommend this book to C# developers.”
    Tom Zhou
    Microsoft Senior Software Engineer
  • “Awesome book for developers who are interested in learning or advancing LINQ or functional programming. It covers real world examples and theories. I have been using C# for more than 10 years but still learned new knowledge from this book. It is well organized and lots of concrete code samples, easy for readers to digest.”
    Carol Hu
    Microsoft Senior Software Engineer
  • “I like the way the author presented the detailed knowledge with a lot of examples. As a data scientist with statistics background in a number of industries, I can pick up C# programming and LINQ quickly when I followed the book. The book was concise and easy to read. It was a pleasant experience for me to spend my time emerging myself in the book in the sunshine weekday afternoon.”
    Xue Liu
    Microsoft Senior Data Scientist
  • “Great book! It takes a hands-on approach to LINQ and functional programming in an easy to understand format. I would highly recommend this book to developers looking to develop expertise in C#, functional programming, and LINQ.”
    Himanshu Lal
    Microsoft Principal Software Engineering Manager
  • “An excellent book for those of us who need to get in-depth understanding on LINQ and functional programming with latest C# language. The author made sure this book includes the latest and cross-platform knowledge for the language, the framework, as well as the underlying mathematical theories.”
    Hongfei Guo
    Microsoft Principal PM Manager
  • “This is a great book for developers who want to go functional programming. It's one-stop shopping for serious developers who have to get up to speed with LINQ and functional programming quickly and in-depth. I'll keep this book on my desk not on my bookshelf.”
    Microsoft Senior Software Engineering Manager
  • “A C# functional programming book truly for .NET and .NET Core developers, from an authority on the subject. I'll be turning to this book first when I need to understand functional programming and LINQ..”
    Surabhi Pandey
    Microsoft Senior Software Engineer

The following are the acclaim from technical community:

  • “This book provides comprehensive and in-depth information about the C# functional programming and LINQ technologies to application developers on both .NET Framework and .NET Core. The detailed text and wealth of examples will give a developer a clear and solid understanding of C# language, functional programming and using LINQ to work with different data domains.”
    Dong Si
    Assistant Professor, Department of Computer Science, University of Washington, Bothell
  • “This book offers a comprehensive, in-depth, yet easy-to-understand tutorial to functional C# programming and LINQ. Filled with detailed explanations and real-world examples, this book is highly valuable for beginners and experienced developers alike.”
    Shuang Zhao
    Assistant Professor, Department of Computer Science, University of California, Irvine
  • “This book provides very comprehensive treatment of functional programming and LINQ. Dixin did a tremendous job at collecting information and wrote real world examples. This book also covers underlying functional programming concepts in great detail and shows how to take advantage of the language features in everyday application code. I'm happy with the book and highly recommended it.”
    Yong Zheng
    Google Senior Software Engineer
  • “This excellent book is an in-depth and also readable exploration of C# functional programming and LINQ programming. It covers .NET Framework and .NET Core in great detail.”
    Yang Sha
    Google Senior Software Engineer
  • “Dixin did an excellent job to write this book for anyone who wants to learn LINQ/functional programming in C#. It has lots of very practical hands-on materials so it is very easy to learn from. It also contains lots of details and has well explained the theory, so it can be used as one-stop reference book!”
    Hua Wang
    Uber Senior Software Engineer
  • “This is a great book that combines practical examples with in-depth analysis of LINQ and functional programming in C#. Dixin leverages his expertise in .NET to provide a well written tutorial on the effective use of LINQ and an overview of the theoretical principles behind it. A must read for anyone working on these technologies!”
    Dimitrios Soulios
    Amazon Software Development Manager
  • “This book does a phenomenal job of explaining various facets of the LINQ and functional programming in C#. Tutorials provided in the book seamlessly fill the gap between the theory and its application. I highly recommend this book for both beginner and experienced developers in the .NET world.”
    Amit Soni
    Amazon Software Engineer
  • “This is a really terrific .NET book, which covers C# language and LINQ in depth. And it enormously broadens my vision for the explanation about functional programming. It would be really helpful for my work in the future.”
    Kerry Jiang
    MVP
  • “This book is a great tutorial. It covers LINQ and functional programming with the latest C# language. It is a fundamental and also in-depth book for both beginners and also experienced developers. If you want to have a deep dive into LINQ technologies, functional programming, and build cross platform applications, I highly recommend this book to you.”
    Tony Qu
    MVP

Contents at a Glance

The contents are organized as the following chapters:

  • Part 1 Code - covers functional programming via C#, and fundamentals of LINQ.
    • Chapter 1 LINQ and Functional Paradigm
      • What is LINQ, how LINQ uses language to work with many different data domains.
      • Programming paradigm, imperative vs. declarative programming, object-oriented vs. functional programming.
    • Chapter 2 Functional C#
      • C# fundamentals for beginners.
      • Aspects of functional programming via C#, including function type, named/anonymous/local function, closure, lambda, higher-order function, currying, partial application, first class function, function composition, query expression, covariance/contravariance, immutability, tuple, purity, async function, pattern matching, etc., including how C# is processed at compile time and runtime.
  • Part 2 Data - covers how to use functional LINQ to work with different data domains in the real world, and how LINQ works internally.
    • Chapter 3 LINQ to Objects
      • How to use functional LINQ queries to work with objects, covering all LINQ and Ix.
      • How the LINQ to Objects query methods are implemented, how to implement useful custom LINQ queries.
    • Chapter 4 LINQ to XML
      • How to modeling XML data, and use functional LINQ queries to work with XML data.
      • How to use the other LINQ to XML APIs to manipulate XML data.
    • Chapter 5 Parallel LINQ
      • How to use parallelized functional LINQ queries to work with objects.
      • Performance analysis for parallel/sequential LINQ queries.
    • Chapter 6 Entity Framework/Core and LINQ to Entities
      • How to model database with object-relational mapping, and use functional LINQ queries to work with relational data in database.
      • How the C# LINQ to Entities queries are implemented to work with database.
      • How to change data in database, and handle concurrent conflicts.
      • Performance tips and asynchrony.
  • Part 3 Theories - demystifies the abstract mathematics theories, which are the rationale and foundations of LINQ and functional programming.
    • Chapter 7 Lambda Calculus via C#
      • Core concepts of lambda calculus, bound and free variables, reduction (α-conversion, β-reduction, η-conversion), etc.
      • How to use lambda functions to represent values, data structures and computation, including Church Boolean, Church numbers, Church pair, Church list, and their operations.
      • Combinators and combinatory logic, including SKI combinator calculus, fixed point combinator for function recursion, etc.
    • Chapter 8 Category Theory via C#
      • Core concepts of category theory, including category, object, morphism, monoid, functor, natural transformation, applicative functor, monad, and their laws.
      • How these concepts are applied in functional programming and LINQ.
      • How to manage I/O, state, exception handling, shared environment, logging, and continuation, etc., in functional programming.

This tutorial delivers highly reusable knowledge:

  • It covers C# language in depth, which can be generally applied in any programming paradigms besides functional programming.
  • It is a cross platform tutorial, covering both .NET Framework for Windows and .NET Core for Windows, Mac, Linux.
  • It demonstrates both usage and implementation of LINQ for mainstream data domains, which also enables developer to use the LINQ technologies for other data domains, or build custom LINQ APIs for specific data scenarios.
  • It also demystifies the abstract mathematics knowledge for functional programming, which applies to general functional programming, so it greatly helps developers understanding any other functional languages too.

As a fun of functional programming, LINQ, C#, and .NET technologies, hope this helps.

20150522_202020724_iOS

(Me [left] and Anders Hejlsberg [right], Father of C#)

Table of Contents

All code examples are available on GitHub.

  1. LINQ and functional paradigm

    1. Getting started

      • .NET Framework, C# and LINQ
      • Functional programming
      • This tutorial
      • Code examples
      • Author
      • Tools
    2. What is LINQ

      • One language for different data domains
        • LINQ to Objects
        • Parallel LINQ
        • LINQ to XML
        • LINQ to DataSets
        • LINQ to Entities
        • LINQ to SQL
        • LINQ to NoSQL (LINQ to DocumentDB)
        • LINQ to JSON
        • LINQ to Twitter
      • Productivity
      • Local query vs. remote query
    3. What is functional programming

      • Programming paradigms
      • Imperative programming vs. declarative programming
      • Object-oriented programming vs. functional programming
  2. Functional programming in-depth

    1. C# language fundamentals

      • Types and members
        • Built-in types
        • Reference type vs. value type
      • Static class
      • Partial type
      • Interface implementation
      • Generic type
        • Type parameter constraints
      • Nullable value type
      • IDisposable and using statement
      • Auto property
      • Property initializer
      • Object initializer
      • Collection initializer
      • Index initializer
      • Null coalescing operator
      • Null conditional operator
      • String interpolation
      • nameof expression
    2. Function type and delegate

      • Delegate type
        • Function type
        • Generic delegate type
        • Unified built-in delegate types
      • Delegate instance
        • Function
        • Delegate class and delegate object
        • Function group
      • Index initializer
    3. Function parameter and return value

      • Pass by value vs. pass by reference (ref parameter)
        • Pass by read only reference (in parameter)
      • Output parameter (out parameter) and out variable
      • Parameter array
      • Positional argument vs. named argument
      • Required parameter vs. optional parameter
      • Caller information parameter
      • Return by value vs. return by reference
        • Return by read only reference
    4. Named Function: Static, instance, extension method

      • Function member and function member name
      • Method overload and ad hoc polymorphism
      • Generic method and parametric polymorphism
        • Type argument inference
      • Static vs. instance method
      • Extension method
      • Partial method
      • using static directive
    5. Local function and closure

      • Local function
      • Closure
        • Outer variable
        • Implicit reference
    6. Anonymous function and lambda expression

      • Anonymous method
      • Lambda expression
      • Call anonymous function
      • Closure
      • Expression bodied function member
    7. Expression tree: Function as data

      • Lambda expression as expression tree
        • Code as data
        • .NET expressions
      • Compile expression tree at runtime
        • Traverse expression tree
        • Expression tree to CIL at runtime
        • Expression tree to executable function at runtime
      • Expression tree and LINQ remote query
    8. Higher-order function, currying and first class function

      • First order and higher-order function
      • Curry function
      • => associativity
      • Partial apply function
      • Uncurry function
      • First-class function
    9. Function composition and chaining

      • Forward and backward composition
      • Forward pipe
      • Fluent chaining
        • Fluent extension methods
      • LINQ query method composition
    10. LINQ query Expression

      • Syntax and compilation
      • Query expression pattern
      • LINQ query expression
      • Query expression vs. query method
    11. Covariance and contravariance

      • Non-generic function type
      • Generic function type
      • Generic interface
      • Generic higher-order function type
      • Array
      • Variances in .NET and LINQ
    12. Immutability, anonymous type and tuple

      • Immutable value
        • Constant
        • using statement and foreach statement
        • this reference for class
        • Function’s readonly parameter and readonly return
        • Local variable by readonly reference (ref readonly variable)
        • Immutable value in LINQ query expression
      • Immutable state (immutable data type)
        • Type with constant field
        • Immutable class with readonly instance field
        • Immutable structure (readonly structure)
        • Immutable anonymous type
        • Immutable tuple vs. mutable tuple
          • Construction and element name
          • Deconstruction
          • Tuple assignment
        • Immutable collection vs. readonly collection
    13. Pure function

      • Referential transparency and side effect free
      • PureAttribute and code contracts
      • Purity in .NET
    14. Asynchronous function

      • Task, Task<TResult> and asynchrony
      • Named async function
      • Awaitable-awaiter pattern
      • Async state machine
      • Generalized async return type and async method builder
        • ValueTask<TResult> and performance
      • Runtime context capture
      • Anonymous async function
    15. Pattern matching

      • Is expression
      • Switch statement
  3. LINQ to Objects: Querying objects in memory

    1. Sequential LINQ query

      • Iteration pattern and foreach statement
      • IEnumerable<T> and IEnumerator<T>
        • EnumerableAssert utility
        • foreach loop vs. for loop
        • Non-generic sequence vs. generic sequence
      • LINQ to Objects queryable types
    2. LINQ to Objects standard queries and query expressions

      • Return a new IEnumerable<T> sequence
        • Generation: Empty , Range, Repeat, DefaultIfEmpty
        • Filtering (restriction): Where, OfType, where
        • Mapping (projection): Select, SelectMany, from, let, select
        • Grouping: GroupBy, group, by, into
        • Join
          • Inner join: Join, SelectMany, join, on, equals
          • Outer join: GroupJoin, join, into, on, equals
          • Cross join: SelectMany, Join, from select, join, on, equals
        • Concatenation: Concat
        • Set: Distinct, Union, Intersect, Except
        • Convolution: Zip
        • Partitioning: Take, Skip, TakeWhile, SkipWhile
        • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending, Reverse, orderby, ascending, descending, into
        • Conversion: Cast, AsEnumerable
      • Return a new collection
        • Conversion: ToArray, ToList, ToDictionary, ToLookup
      • Return a single value
        • Element: First, FirstOrDefault, Last, LastOrDefault, ElementAt, ElementAtOrDefault, Single, SingleOrDefault
        • Aggregation: Aggregate, Count, LongCount, Min, Max, Sum, Average
        • Quantifier: All, Any, Contains
        • Equality: SequenceEqual
      • Queries in other languages
    3. Generator

      • Implement iterator pattern
      • Generate sequence and iterator
      • Yield statement and generator
      • Iterator and generator in other languages
    4. Deferred execution, lazy evaluation and eager Evaluation

      • Deferred execution vs. immediate execution
        • Cold IEnumerable<T> vs. hot IEnumerable<T>
      • Lazy evaluation vs. eager evaluation
    5. LINQ to Objects internals: Standard queries implementation

      • Argument check and deferred execution
      • Return a new collection
        • Conversion: ToArray, ToList, ToDictionary, ToLookup
      • Return a new IEnumerable<T> sequence
        • Conversion: Cast, AsEnumerable
        • Generation: Empty , Range, Repeat, DefaultIfEmpty
        • Filtering (restriction): Where, OfType
        • Mapping (projection): Select, SelectMany
        • Grouping: GroupBy
        • Join: SelectMany, Join, GroupJoin
        • Concatenation: Concat
        • Set: Distinct, Union, Intersect, Except
        • Convolution: Zip
        • Partitioning: Take, Skip, TakeWhile, SkipWhile
        • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending, Reverse
      • Return a single value
        • Element: First, FirstOrDefault, Last, LastOrDefault, ElementAt, ElementAtOrDefault, Single, SingleOrDefault
        • Aggregation: Aggregate, Count, LongCount, Min, Max, Sum, Average
        • Quantifier: All, Any, Contains
        • Equality: SequenceEqual
    6. Microsoft Interactive Extensions (Ix): More powerful queries

      • Returns a new IEnumerable<T> sequence
        • Generation: Defer, Create, Return, Repeat
        • Filtering: IgnoreElements, DistinctUntilChanged
        • Mapping: SelectMany, Scan, Expand
        • Concatenation: Concat, StartWith
        • Set: Distinct
        • Partitioning: TakeLast, SkipLast
        • Conversion: Hide
        • Buffering: Buffer, Share, Publish, Memoize
        • Exception: Throw, Catch, Finally, OnErrorResumeNext, Retry
        • Imperative: If, Case, Using, While, DoWhile, Generate, For
        • Iteration: Do
      • Returns void
        • Iteration: ForEach
      • Returns a single value
        • Aggregation: Min, Max, MinBy, MaxBy
        • Quantifiers: isEmpty
    7. Building custom queries

      • Returns a new IEnumerable<T> sequence (deferred execution)
        • Generation: Create, RandomInt32, RandomDouble, FromValue, FromValues, EmptyIfNull
        • Filtering: Timeout
        • Concatenation: Join, Append, Prepend, AppendTo, PrependTo
        • Partitioning: Subsequence
        • Exception: Catch, Retry
        • Comparison: OrderBy, OrderByDescending, ThenBy, ThenByDescending, GroupBy, Join, GroupJoin, Distinct, Union, Intersect, Except
        • List: Insert, Remove, RemoveAll, RemoveAt
      • Returns a new collection
        • Comparison: ToDictionary, ToLookup
      • Returns a single value
        • List: IndexOf, LastIndexOf
        • Aggregation: PercentileExclusive, PercentileInclusive, Percentile
        • Quantifiers: IsNullOrEmpty, IsNotNullOrEmpty
        • Comparison: Contains, SequenceEqual
      • Returns void
        • Iteration: ForEach
  4. LINQ to XML: Querying XML

    1. Modeling XML

      • Imperative vs. declarative paradigm
      • Types, conversions and operators
      • Read and deserialize XML
      • Serialize and write XML
      • Deferred construction
    2. LINQ to XML standard queries

      • Navigation
      • Ordering
      • Comparison
      • More useful queries
      • XPath
      • Generate XPath expression
    3. Manipulating XML

      • Clone
      • Add, replace, delete, update, and events
      • Annotation
      • Validate with XSD
      • Transform
  5. Parallel LINQ: Querying objects in paralle

    1. Parallel LINQ query and visualization

      • Parallel LINQ classes and methods
      • Parallel query vs. sequential query
      • Execute parallel query
      • Visualize parallel query execution
        • Install and configure Concurrency Visualizer
        • Visualize sequential and parallel LINQ queries
        • Visualize chaining query methods
    2. Parallel LINQ internals: data partitioning

      • Partitioning algorithms and load balancing
        • Range partitioning
        • Stripped partitioning
        • Hash partitioning
        • Chunk partitioning
      • Implement custom partitioner
        • Static partitioner
        • Dynamic partitioner
    3. Parallel LINQ standard queries

      • Query settings
        • Cancellation
        • Degree of parallelism
        • Execution mode
        • Merge the values
      • Ordering
        • Control the order
        • Order and correctness
        • Orderable partitioner
      • Aggregation
        • Commutativity, associativity and correctness
        • Partition and merge
    4. Parallel query performance

      • Sequential vs. parallel
      • CPU bound vs. IO bound
      • Summary
  6. Entity Framework/Core and LINQ to Entities: Querying relational data

    1. Remote LINQ query

      • Entity Framework and Entity Framework Core
      • SQL database
      • Remote query vs. local query
      • Function vs. expression tree
    2. Modeling Database: Object-Relational Mapping

      • Data types
      • Database
        • Connection resiliency and execution strategy
      • Tables
      • Relationships
        • One-to-one
        • One-to-many
        • Many-to-many
      • Inheritance
      • Views
      • Stored procedures and functions
    3. Logging and tracing LINQ to Entities queries

      • Application side logging
      • Database side tracing with Extended Events
    4. LINQ to Entities standard queries

      • Return a new IQueryable<T> source
        • Generation: DefaultIfEmpty
        • Filtering (restriction): Where, OfType
        • Mapping (projection): Select
        • Grouping: GroupBy
        • Join
          • Inner join: Join, SelectMany, GroupJoin, Select
          • Outer join: GroupJoin, Select, SelectMany
          • Cross join and self join: SelectMany, Join
        • Concatenation: Concat
        • Set: Distinct, Union, Intersect, Except
        • Partitioning: Take, Skip
        • Ordering: OrderBy, ThenBy, OrderByDescending, ThenByDescending
        • Conversion: Cast, AsQueryable
      • Return a single value
        • Element: First, FirstOrDefault, Single, SingleOrDefault
        • Aggregation: Count, LongCount, Min, Max, Sum, Average
        • Quantifier: All, Any, Contains
    5. LINQ to Entities internals: Query translation implementation

      • Code to LINQ expression tree
        • IQueryable<T> and IQueryProvider
        • Queryable methods
        • Build LINQ to Entities abstract syntax tree
      • .NET expression tree to database expression tree
        • Database query abstract syntax tree
        • Compile LINQ expressions to database expressions
        • Compile LINQ query method calls
        • Compile .NET API calls
        • Remote API call vs. local API call
        • Compile database function call
      • Database expression tree to SQL
        • SQL generator and SQL command
        • Generate SQL from database expression tree
    6. Loading query data

      • Deferred execution
        • Iterator pattern
        • Lazy evaluation vs. eager evaluation
      • Explicit loading
      • Eager loading
      • Lazy loading
        • The N + 1 problem
        • Disable lazy loading
    7. Manipulating relational data: Data change and transaction

      • Repository pattern and unit of work pattern
      • Track entities and changes
        • Track entities
        • Track entity changes and property changes
        • Track relationship changes
        • Enable and disable tracking
      • Change data
        • Create
        • Update
        • Delete
      • Transaction
        • Transaction with connection resiliency and execution strategy
        • EF/Core transaction
        • ADO.NET transaction
        • Transaction scope
    8. Resolving optimistic concurrency

      • Detect concurrent conflicts
      • Resolve concurrent conflicts
        • Retain database values (database wins)
        • Overwrite database values (client wins)
        • Merge with database values
      • Save changes with concurrent conflict handling
    9. Performance

      • Initialization
        • Provider initialization
        • Database initialization
        • Mapping views initialization
      • Cache
        • Entity cache
        • LINQ query translation cache
        • SQL query plan cache
      • Asynchrony
        • Asynchronous data queries and data changes
        • Transactions and connection resiliency with asynchronous operations
        • Asynchronous concurrent conflicts
  7. Lambda Calculus via C#: The fundation of all functional programming

    1. Fundamentals

      • Expression
        • Bound variable vs. free variable
      • Reductions
        • α-conversion (alpha-conversion)
        • β-reduction (beta-reduction)
        • η-conversion (eta-conversion)
        • Normal order
        • Applicative order
      • Function composition
        • Associativity
        • Unit
    2. Church encoding: Function as boolean and logic

      • Church encoding
      • Church Boolean
      • Logical operators
      • Conversion between Church Boolean and System.Boolean
      • If
    3. Church encoding: Function as numeral, arithmetic and predicate

      • Church numerals
      • Increase and decrease
      • Arithmetic operators
      • Predicate and relational operators
        • Attempt of recursion
      • Conversion between Church numeral and System.UInt32
    4. Church encoding: Function as uple and signed numeral

      • Church pair (2-tuple)
        • Tuple operators
      • N-tuple
      • Signed numeral
        • Arithmetic operators
    5. Church encoding: Function as list

      • Tuple as list node
        • List operators
      • Aggregation function as list node
        • List operators
      • Model everything
    6. Combinatory logic

      • Combinator
      • SKI combinator calculus
        • SKI compiler: compile lambda calculus expression to SKI calculus combinator
      • Iota combinator calculus
    7. Fixed point combinator and recursion

      • Normal order fixed point combinator (Y combinator) and recursion
      • Applicative order fixed point combinator (Z combinator) and recursion
    8. Undecidability of equivalence<

      • Halting problem
      • Equivalence problem
  8. Category Theory via C#: The essentials and design of LINQ

    1. Fundamentals: Category and morphism

      • Category and category laws
      • DotNet category
    2. Monoid

      • Monoid and monoid laws
      • Monoid as category
    3. Functor and LINQ to Functors

      • Functor and functor laws
        • Endofunctor
        • Type constructor and higher-kinded type
      • LINQ to Functors
        • Built-in IEnumerable<> functor
        • Functor pattern of LINQ
      • More LINQ to Functors
    4. Natural Transformation

      • Natural transformation and naturality
      • Functor Category
        • Endofunctor category
    5. Bifunctor

      • Bifunctor
      • Monoidal category
    6. Monoidal functor and applicative functor

      • Monoidal functor
        • IEnumeable<> monoidal functor
      • Applicative functor
        • IEnumeable<> applicative functor
      • Monoidal functor vs. applicative functor
      • More Monoidal functors and applicative functors
    7. Monad and LINQ to Monads

      • Monad
      • LINQ to Monads and monad laws
        • Built-in IEnumerable<> monad
        • Monad laws and Kleisli composition
        • Kleisli category
        • Monad pattern of LINQ
      • Monad vs. monoidal/applicative functor
      • More LINQ to Monads
    8. Advanced LINQ to Monads

      • IO monad
      • State monad
      • Try monad
      • Reader monad
      • Writer monad
      • Continuation monad

16 Comments

Add a Comment

As it will appear on the website

Not displayed

Your website