Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Reactive Programming for .NET Developers

You're reading from  Reactive Programming for .NET Developers

Product type Book
Published in Jul 2016
Publisher Packt
ISBN-13 9781785882883
Pages 276 pages
Edition 1st Edition
Languages

Table of Contents (15) Chapters

Reactive Programming for .NET Developers
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Preface
First Steps Toward Reactive Programming Reactive Programming with C# Reactive Extension Programming Observable Sequence Programming Debugging Reactive Extensions CLR Integration and Scheduling Advanced Techniques F# and Functional Reactive Programming Advanced FRP and Best Practices

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}