Functional Programming in Ruby
Minimum price
Suggested price

Functional Programming in Ruby

Coding with Style

About the Book

This book teaches you not about what functional programming is. The target of this book is to help the reader to learn to think differently. Learning to program with a functional style will require you to do some rewiring in the brain. 

Instead this book helps you to un-learn some of the patterns you've been so very much used to, and learn new functional programming based patterns that help you build consise and efficient solutions to everyday programming problems. At the same time, it will put things in perspective and put functional programming in context, and discuss the limitations of functional programming in general and in Ruby specificially.

The end goal is that this book should help the reader to become a better programmer. A better programmer for me is someone who's flexible in approaching the problem domain. I'm a strong believer that in the near future, it's going to be more and more key for a developer to know many programming languages and many programming styles. 

That's also one of the reasons why I think Ruby is a good programming language to learn about functional programming style. It's far from perfect. It's not at all pure. It has limitations. But it allows you to mix and match different programming styles.

About the Author

koen handekyn
koen handekyn

Koen Handekyn is CEO of UP-nxt, the R&D business unit of UnifiedPost Group. He also holds the position of CTO at group level. Koen holds a degree in Computer Science engineering from UGent as well as a degree in Business Administration from Vlerick Leuven Gent Management School. Having worked at Alcatel-Lucent, he has a solid background in both telecommunications and innovation.

He has harbored a lifelong interest in software engineering and loves sharing his experiences with students whenever he is invited to act in a lecturer or guest professor capacity. He lives around Ghent and has a main office in Leuven but survives by embracing any and all available teleworking technologies alongside his team. Koen's been passionate about polyglot programming for more than two decades.

Table of Contents

  • Introduction
    • Continues Integration
    • Goal of this book
  • Getting Started
    • ‘For’ considered Harmful
      • Diving in with an Example
      • Comparing Styles
      • Conclusions
      • Short History of Functional Programming
      • The world of functional programming languages
    • The Power of Recursion
      • The beauty of Recursion
      • A study of faculty
      • Divide and concquer
      • Basic Math through recursion
      • Comparing styles
      • Typical list operations
  • Think Different
    • Different styles of Functions in Ruby
      • Defs
      • Lambda’s
      • Short Lambda’s
      • Lambda’s as constants
    • Functional Patterns in Standard Ruby
      • Functions as the Atoms of an Interface
      • Why Bang means Watch Out (Imutable)
      • Iterator and Visitor Revisited
      • No more Factory Method, Strategy, Template Method
    • Pulling your data through the blender
      • Functional processing of data: Filter-Sort-Map-Reduce
      • Group-Theory: Permutations-Combinations-Products
    • Advanced Recursion
      • Sorting Algorithms
      • Backtracking Algorithms
      • Recursive Data Structures
    • linkedlist
    • tree
    • graph
  • More Purity in your thoughts
    • Combining Functions into Programs
      • What’s in a name?
      • Default Parameters and Partial Evoluation
      • Combining Functions into Programs
    • Advanced Data Processing
      • Infinite Data Structures and laziness
      • List Comprehensions
      • Constraint Programming
    • Building our own Prelude
      • Basic Prelude
      • Math Prelude
      • List Prelude
      • Text Prelude
      • Revisiting prior Examples
    • Coming back to the basic algorithms
    • Backtracking algorithms: rewrite
    • What you are missing in Ruby (and workarounds)
      • Pattern matching
      • Lazy evaluation
  • In the field
      • Testing functional code
      • Mixing styles
    • Performance Concerns
    • Sidenotes that appear within the basic text
    • Other topics

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

80% Royalties. Earn $16 on a $20 book.

We pay 80% royalties. That's not a typo: you earn $16 on a $20 sale. If we sell 5000 non-refunded copies of your book or course for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $13 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub