Learning Functional Programming in Go

Function literals, Monads, Lazy evaluation, Currying, and more
Preview in Mapt

Learning Functional Programming in Go

Lex Sheehan

2 customer reviews
Function literals, Monads, Lazy evaluation, Currying, and more

Quick links: > What will you learn?> Table of content> Product reviews

Mapt Subscription
FREE
$29.99/m after trial
eBook
$5.00
RRP $35.99
Save 86%
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$5.00
$44.99
$29.99 p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 14 Day Trial

Frequently bought together


Learning Functional Programming in Go Book Cover
Learning Functional Programming in Go
$ 35.99
$ 5.00
Building RESTful Web services with Go Book Cover
Building RESTful Web services with Go
$ 31.99
$ 5.00
Buy 2 for $10.00
Save $57.98
Add to Cart

Book Details

ISBN 139781787281394
Paperback672 pages

Book Description

Functional programming is a popular programming paradigm that is used to simplify many tasks and will help you write flexible and succinct code. It allows you to decompose your programs into smaller, highly reusable components, without applying conceptual restraints on how the software should be modularized.

This book bridges the language gap for Golang developers by showing you how to create and consume functional constructs in Golang.

The book is divided into four modules. The first module explains the functional style of programming; pure functional programming (FP), manipulating collections, and using high-order functions. In the second module, you will learn design patterns that you can use to build FP-style applications. In the next module, you will learn FP techniques that you can use to improve your API signatures, to increase performance, and to build better Cloud-native applications. The last module delves into the underpinnings of FP with an introduction to category theory for software developers to give you a real understanding of what pure functional programming is all about, along with applicable code examples.

By the end of the book, you will be adept at building applications the functional way.

Table of Contents

Chapter 1: Pure Functional Programming in Go
Motivation for using FP
Getting the source code
Imperative versus declarative programming
Pure functions
Fibonacci sequence - a simple recursion and two performance improvements
The difference between an anonymous function and a closure
Testing FP using test-driven development
A journey from imperative programming to pure FP and enlightenment
Summary
Chapter 2: Manipulating Collections
Iterating through a collection
Piping Bash commands
Functors
Predicates
Map and filter
Contains
If Go had generics
Itertools
Functional  packages
Another time of reflection
The cure
Summary
Chapter 3: Using High-Order Functions
Characteristics of FP
Sample HOF application
Summary
Chapter 4: SOLID Design in Go
Why many Gophers loath Java
Software design methodology
SOLID design principles
The big reveal
Viva La Duck
Summary
Chapter 5: Adding Functionality with Decoration
Interface composition
Decorator pattern
A decorator implementation
Summary
Chapter 6: Applying FP at the Architectural Level
Application architectures
The role of systems engineering
Managing Complexity
FP influenced architectures
Domain Driven Design
Domain Driven Design
A cloud bucket application
FP and Micyoservices
Summary
Chapter 7: Functional Parameters
Refactoring long parameter lists
Functional parameters
Contexts
Summary
Chapter 8: Increasing Performance Using Pipelining
Introducing the pipeline pattern
Example implementations
Summary
Chapter 9: Functors, Monoids, and Generics
Understanding functors
Solve lack of generics with metaprogramming
Generics code generation tool
Generics implementation options
The shape of a functor
Composition operation
Functional composition in the context of a legal obligation
Build a 12-hour clock functor
The car functor
Monoids
Monoid examples
Summary
Chapter 10: Monads, Type Classes, and Generics
Mother Teresa Monad
Monadic workflow implementation
Y-Combinator
An alternative workflow option
Business use case scenarios
Y-Combinator re-examined
Type classes
Generics revisited
Summary
Chapter 11: Category Theory That Applies
Our goal
 Proof theory
The Curry Howard isomorphism
Historical Events in Functional Programming
Programming language categories
The Lambda Calculus
The importance of Type systems to FP
Domains, codomains, and morphisms
Set theory symbols
Category theory
Morphisms
Homomorphism
Composable concurrency
Graph Database Example
Using mathematics and category theory to gain understanding
Fun with Sums, Products, Exponents and Types
Big data, knowledge-driven development, and data visualization
Summary
Chapter 12: Miscellaneous Information and How-Tos
How to build and run Go projects
Development workflow summary
How to propose changes to Go
FP resources
Minggatu - Catalan number

What You Will Learn

  • Learn how to compose reliable applications using high-order functions
  • Explore techniques to eliminate side-effects using FP techniques such as currying
  • Use first-class functions to implement pure functions
  • Understand how to implement a lambda expression in Go
  • Compose a working application using the decorator pattern
  • Create faster programs using lazy evaluation
  • Use Go concurrency constructs to compose a functionality pipeline
  • Understand category theory and what it has to do with FP

Authors

Table of Contents

Chapter 1: Pure Functional Programming in Go
Motivation for using FP
Getting the source code
Imperative versus declarative programming
Pure functions
Fibonacci sequence - a simple recursion and two performance improvements
The difference between an anonymous function and a closure
Testing FP using test-driven development
A journey from imperative programming to pure FP and enlightenment
Summary
Chapter 2: Manipulating Collections
Iterating through a collection
Piping Bash commands
Functors
Predicates
Map and filter
Contains
If Go had generics
Itertools
Functional  packages
Another time of reflection
The cure
Summary
Chapter 3: Using High-Order Functions
Characteristics of FP
Sample HOF application
Summary
Chapter 4: SOLID Design in Go
Why many Gophers loath Java
Software design methodology
SOLID design principles
The big reveal
Viva La Duck
Summary
Chapter 5: Adding Functionality with Decoration
Interface composition
Decorator pattern
A decorator implementation
Summary
Chapter 6: Applying FP at the Architectural Level
Application architectures
The role of systems engineering
Managing Complexity
FP influenced architectures
Domain Driven Design
Domain Driven Design
A cloud bucket application
FP and Micyoservices
Summary
Chapter 7: Functional Parameters
Refactoring long parameter lists
Functional parameters
Contexts
Summary
Chapter 8: Increasing Performance Using Pipelining
Introducing the pipeline pattern
Example implementations
Summary
Chapter 9: Functors, Monoids, and Generics
Understanding functors
Solve lack of generics with metaprogramming
Generics code generation tool
Generics implementation options
The shape of a functor
Composition operation
Functional composition in the context of a legal obligation
Build a 12-hour clock functor
The car functor
Monoids
Monoid examples
Summary
Chapter 10: Monads, Type Classes, and Generics
Mother Teresa Monad
Monadic workflow implementation
Y-Combinator
An alternative workflow option
Business use case scenarios
Y-Combinator re-examined
Type classes
Generics revisited
Summary
Chapter 11: Category Theory That Applies
Our goal
 Proof theory
The Curry Howard isomorphism
Historical Events in Functional Programming
Programming language categories
The Lambda Calculus
The importance of Type systems to FP
Domains, codomains, and morphisms
Set theory symbols
Category theory
Morphisms
Homomorphism
Composable concurrency
Graph Database Example
Using mathematics and category theory to gain understanding
Fun with Sums, Products, Exponents and Types
Big data, knowledge-driven development, and data visualization
Summary
Chapter 12: Miscellaneous Information and How-Tos
How to build and run Go projects
Development workflow summary
How to propose changes to Go
FP resources
Minggatu - Catalan number

Book Details

ISBN 139781787281394
Paperback672 pages
Read More
From 2 reviews

Read More Reviews

Recommended for You

Building RESTful Web services with Go Book Cover
Building RESTful Web services with Go
$ 31.99
$ 5.00
Go: Design Patterns for Real-World Projects Book Cover
Go: Design Patterns for Real-World Projects
$ 71.99
$ 5.00
React Native Blueprints Book Cover
React Native Blueprints
$ 35.99
$ 5.00
Iterators in Functional Programming with Python [Video] Book Cover
Iterators in Functional Programming with Python [Video]
$ 124.99
$ 5.00
LaTeX A-Z: from beginner to advanced in less than 3 hours [Video] Book Cover
LaTeX A-Z: from beginner to advanced in less than 3 hours [Video]
$ 94.99
$ 5.00
Reactive Programming in Kotlin Book Cover
Reactive Programming in Kotlin
$ 35.99
$ 5.00