Skip to Content
Learning Functional Programming in Go
book

Learning Functional Programming in Go

by Lex Sheehan
November 2017
Intermediate to advanced
670 pages
17h 35m
English
Packt Publishing
Content preview from Learning Functional Programming in Go

Color blocks functor

A functor consists of a structure, usually a slice in Go, and a transformation operation, that is, the mapping function:

Structure

Eight blocks, each filled with a different color

Transformation operation

f(x) = x - 30, where x is the hue

 

Below, is a functor that maps eight colored blocks to eight corresponding blocks whose color has been altered by applying the transformation operations above to adjust the hue of the color displayed in the boxes.

The preceding diagram shows a single f(x) arrow to keep the clutter to a minimum, but a more accurate representation would show arrows from each original element ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Learning Functional Programming

Learning Functional Programming

Jack Widman

Publisher Resources

ISBN: 9781787281394Supplemental Content