Learning Functional Programming in Go
Change the way you approach your applications using functional programming in Go
Lex Sheehan
BIRMINGHAM - MUMBAI
Learning Functional Programming in Go
Copyright 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: November 2017
Production reference: 1221117
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78728-139-4
www.packtpub.com
Credits
Author Lex Sheehan | Copy Editor Pranjali Chury |
Reviewer John Pradeep | Project Coordinator Vaidehi Sawant |
Commissioning Editor Merint Mathew | Proofreader Safis Editing |
Acquisition Editor Karan Sadawana | Indexer Rekha Nair |
Content Development Editor Rohit Kumar Singh | Graphics Jason Monteiro |
Technical Editor Pavan Ramchandani | Production Coordinator Shraddha Falebhai |
About the Author
Lex Sheehan has a B.S. in Computer Science from Auburn University, resides in Atlanta, GA, and works as a senior software engineer with over 20 years of experience. He has a deep understanding of functional programming; His first encounter was using high-order functions in Ruby, Scala, JavaScript, Haskell, Java, and Go.
Lex worked for IBM Software Group and IBM Global Business Services, designing and building various enterprise business systems. He is the author of eight US patents (IT security and data transformations) and he writes a blog titled Application Development with Lex Sheehan.
Lex is available to consult and meet with your CTO, or provide in-house training on the information in this book.
Acknowledgments
I would like to acknowledge the people who helped me during the writing of this book.
Thank you, Rohit, for editing my writing and providing your insight, guidance, and words of encouragement.
Thank you, John and Wayne, for reviewing this book for technical accuracy. Thank you to all other reviewers who helped improve the quality of this book's content.
Thank you, Mac, for being my wise counsel.
Thank you, Marty, for being my sounding board.
Thank you, Erik, for providing legal counsel regarding the Forgetful Functor.
Thank you all who lifted me up in your prayers during this endeavor.
Thank you, Salim, for your support. Your leadership style has earned my trust and loyalty.
Thank you, to the one who would say, "Lex Brilliance". That was and still is a great source of inspiration. Words matter.
We are all given talents. Some fear failure and suffer for it; others invest their talents.
This book is dedicated to those who invest in themselves and go on to help others.
"Do or do not. There is no try".
- Yoda
About the Reviewer
John Pradeep is a software engineer with over 10 years of experience in designing and developing various applications in an agile way.
After working on multiple languages (Lisp being his favorite), he has recently started using Go for its clear set of design goals and simplicity. Now, Go has become his language of choice for most projects that he works on.
He loves finding simple solutions to complex problems, and he is also a huge fan of methodologies that help build elegant systems such as functional programming, domain-driven design, CQRS, reactive architectures, and so on.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com .
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com , you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
- Fully searchable across every book published by Packt
- Copy and paste, print, and bookmark content
- On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1787281396.
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Preface
Until recently, the message has been Go and functional programmingdon't do it.
Functional programming (FP) is a perfect fit for multicore, parallel processing. Go is a concurrency baller (with Goroutines, channels, and so on) and already runs on every available CPU core. FP reduces complexity; simplicity is one of Go's biggest strengths.
So, what can FP bring to Go that will actually improve our software applications? Here's what it offers:
Next page