F# 4.0 Design Patterns

Learn how to apply functional F# design patterns to a huge range of programming challenges, and discover a smart route to building better applications

F# 4.0 Design Patterns

This ebook is included in a Mapt subscription
Gene Belitski

1 customer reviews
Learn how to apply functional F# design patterns to a huge range of programming challenges, and discover a smart route to building better applications
$0.00
$35.99
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 4,000+ eBooks & Videos
  • 40+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781785884726
Paperback318 pages

Book Description

Following design patterns is a well-known approach to writing better programs that captures and reuses high-level abstractions that are common in many applications. This book will encourage you to develop an idiomatic F# coding skillset by fully embracing the functional-first F# paradigm. It will also help you harness this powerful instrument to write succinct, bug-free, and cross-platform code.

F# 4.0 Design Patterns will start off by helping you develop a functional way of thinking. We will show you how beneficial the functional-first paradigm is and how to use it to get the optimum results. The book will help you acquire the practical knowledge of the main functional design patterns, the relationship of which with the traditional Gang of Four set is not straightforward.

We will take you through pattern matching, immutable data types, and sequences in F#. We will also uncover advanced functional patterns, look at polymorphic functions, typical data crunching techniques, adjusting code through augmentation, and generalization. Lastly, we will take a look at the advanced techniques to equip you with everything you need to write flawless code.

Table of Contents

Chapter 1: Begin Thinking Functionally
Relationship between F# and programming paradigms
A sample problem to solve
Immutability of participating data entities
Thinking in verbs rather than nouns
"What" prevailing over "how"
Generalization over specialization
Minimizing moving parts over hiding them
Reduction to known parts over producing custom parts
Lazy over eager data collections
Summary
Chapter 2: Dissecting F# Origins and Design
The evolvement of F#
Predecessor inherited language features
.NET-imposed language features
Intrinsic F# language features
Summary
Chapter 3: Basic Functions
The notion of function in F#
Function parameters and arguments
Higher-order functions
Closures
Type inference
Recursive function basics
Operators as functions
Function composition
Summary
Chapter 4: Basic Pattern Matching
An explicit form of pattern matching with match construction
Matching literals
Wildcard matching
Arranging matching rules
Named patterns
The as pattern
Grouping patterns
Guards
The alternative syntax for anonymous function performing matching
Summary
Chapter 5: Algebraic Data Types
Combining data with algebraic data types
Product algebraic data types
Sum algebraic data types
Summary
Chapter 6: Sequences - The Core of Data Processing Patterns
Basic sequence transformations
The sequence: Duality of data and calculation
Sequence of an indefinite length as a design pattern
Sequence and the code performance
Summary
Chapter 7: Advanced Techniques: Functions Revisited
A deep dive into recursion
Folding
Memoization
Lazy evaluation
Continuation passing style
Active patterns
Summary
Chapter 8: Data Crunching – Data Transformation Patterns
Core data transformation libraries in F# 4.0
Data transformation patterns
Summary
Chapter 9: More Data Crunching
Data querying
Data parsing
Summary
Chapter 10: Type Augmentation and Generic Computations
Code generalization
Type augmentation
Summary
Chapter 11: F# Expert Techniques
A note on custom computation expressions
Exploring type providers
Exploring concurrent computations
Exploring reactive computations
Exploring quotations and metaprogramming
Summary
Chapter 12: F# and OOP Principles/Design Patterns
Morphing SOLID principles
Diminishing patterns
Summary
Chapter 13: Troubleshooting Functional Code
Why idiomatic F# admits less defects
Using REPL and the explorative programming style
Addressing some compile-time problems
Addressing run-time problems
Summary

What You Will Learn

  • Acquire the practical knowledge to use the main functional design patterns
  • Realign some imperative and object-oriented principles under the functional approach
  • Develop your confidence in building and combining first-order and higher-order functions
  • Learn to use core language pattern matching effectively
  • Make use of native F# algebraic data types in place of custom-built classes
  • Recognize and measure the difference in resource consumption between sequences and materialized data collections
  • Navigate and use F# Core libraries with ease by seeing patterns behind specific library functions
  • Master writing generic polymorphic code

Authors

Table of Contents

Chapter 1: Begin Thinking Functionally
Relationship between F# and programming paradigms
A sample problem to solve
Immutability of participating data entities
Thinking in verbs rather than nouns
"What" prevailing over "how"
Generalization over specialization
Minimizing moving parts over hiding them
Reduction to known parts over producing custom parts
Lazy over eager data collections
Summary
Chapter 2: Dissecting F# Origins and Design
The evolvement of F#
Predecessor inherited language features
.NET-imposed language features
Intrinsic F# language features
Summary
Chapter 3: Basic Functions
The notion of function in F#
Function parameters and arguments
Higher-order functions
Closures
Type inference
Recursive function basics
Operators as functions
Function composition
Summary
Chapter 4: Basic Pattern Matching
An explicit form of pattern matching with match construction
Matching literals
Wildcard matching
Arranging matching rules
Named patterns
The as pattern
Grouping patterns
Guards
The alternative syntax for anonymous function performing matching
Summary
Chapter 5: Algebraic Data Types
Combining data with algebraic data types
Product algebraic data types
Sum algebraic data types
Summary
Chapter 6: Sequences - The Core of Data Processing Patterns
Basic sequence transformations
The sequence: Duality of data and calculation
Sequence of an indefinite length as a design pattern
Sequence and the code performance
Summary
Chapter 7: Advanced Techniques: Functions Revisited
A deep dive into recursion
Folding
Memoization
Lazy evaluation
Continuation passing style
Active patterns
Summary
Chapter 8: Data Crunching – Data Transformation Patterns
Core data transformation libraries in F# 4.0
Data transformation patterns
Summary
Chapter 9: More Data Crunching
Data querying
Data parsing
Summary
Chapter 10: Type Augmentation and Generic Computations
Code generalization
Type augmentation
Summary
Chapter 11: F# Expert Techniques
A note on custom computation expressions
Exploring type providers
Exploring concurrent computations
Exploring reactive computations
Exploring quotations and metaprogramming
Summary
Chapter 12: F# and OOP Principles/Design Patterns
Morphing SOLID principles
Diminishing patterns
Summary
Chapter 13: Troubleshooting Functional Code
Why idiomatic F# admits less defects
Using REPL and the explorative programming style
Addressing some compile-time problems
Addressing run-time problems
Summary

Book Details

ISBN 139781785884726
Paperback318 pages
Read More
From 1 reviews

Read More Reviews