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

Anonymous function example and type inference

First, let's look at what we mean by the term anonymous function.

Function literals in Go require us to declare its type (int in our preceding example). In pure functional languages like Haskell and even Java 8 and above, the compilers of those languages are able to infer the type of the lambda expression without requiring use to declare it inline. Those compilers need minimal information to infer the types of expressions at runtime. If the compiler sees an expression with an argument of 5 and the "+" operator, a language with type inference will not require us to specifically indicate that we ...

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