Book Image

Reactive Programming for .NET Developers

Book Image

Reactive Programming for .NET Developers

Overview of this book

Reactive programming is an innovative programming paradigm focused on time-based problem solving. It makes your programs better-performing, easier to scale, and more reliable. Want to create fast-running applications to handle complex logics and huge datasets for financial and big-data challenges? Then you have picked up the right book! Starting with the principles of reactive programming and unveiling the power of the pull-programming world, this book is your one-stop solution to get a deep practical understanding of reactive programming techniques. You will gradually learn all about reactive extensions, programming, testing, and debugging observable sequence, and integrating events from CLR data-at-rest or events. Finally, you will dive into advanced techniques such as manipulating time in data-flow, customizing operators and providers, and exploring functional reactive programming. By the end of the book, you'll know how to apply reactive programming to solve complex problems and build efficient programs with reactive user interfaces.
Table of Contents (15 chapters)
Reactive Programming for .NET Developers
About the Authors
About the Reviewer

Active Patterns

Active Patterns are conceptually similar to discriminated unions. What really changes is how they are used, not the syntax.

By definition, it can be said that an active pattern is a set of called partitions used to compare the input data. Also, these partitions (labels) can be used in expression.

This is the syntax:

let (|identifer1|identifier2|...|) [ arguments ] = expression 
let (|identifier|_|) [ arguments ] = expression 

As we can see in the preceding code lines, there are two different implementations. They are as follows:

  • Complete Active Patterns: They are described in the first row and all the labels are explicitly denominated. They must be a maximum of seven and each one must have a result return.

  • Partial Active Patterns: It is similar, but one's choice must be the wildcard operator |_| seen previously. This operator is used to define all the cases in which the input must not be partitioned.

The main example to understand how to use the action pattern is as...