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

EmphasizeHumanize ordered incorrectly

When we try to reverse the order of operations, this is what we're trying to do:

This does not compute.

We start by passing a Boolean true to Emphasize, but what does that mean?  What are we trying to do?  We are not changing the direction of the arrows, but we are attempting to change the order in which we call them. Given our context of beginning with a Boolean and trying to get a "yes!!" or a "no!!" out, it only makes sense to apply our Humanize and Emphasize functions in one direction. We are, in effect, trying to compose backwards:

func Compose(f Fss, g Fbs) Fbs {   return func(n bool) string {      return ...
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