Functional Ruby

Apply functional ideas like Referential Transparency, Immutability, Functional Composition, and Pattern-Matching in practical, idiomatic Ruby code

If there is one trend that has dominated the evolution of programming languages over the last twenty years, it is the steady growth of Functional Programming concepts: from academic preoccupation, to a broadly embraced paradigm for application work. While the style was initially popularized in languages like Haskell, OCaml, Scala, Clojure, F#, and Elm, features and libraries for functional programming have steadily filtered into almost every programming language.

Ruby is no exception to this trend. Even from its beginnings, Ruby encouraged a functional style in certain areas. E.g. Ruby has always had easy lambdas with local closure, in the form of Procs. Rubyists have always been encouraged to pass anonymous functions as arguments, in the form of Blocks. And it has always been idiomatic when working with collections to use methods like map and reduce (even if reduce was originally called inject).

But Ruby has also grown more functional with time, as functional approaches have become more popular. And the community has evolved new conventions for writing Ruby in a functional style. That’s what this course is about: how to apply functional ideas like Referential Transparency, Immutability, Functional Composition, and Pattern-Matching in practical, idiomatic Ruby code.

This course is far from a comprehensive introduction to functional programming in Ruby, let along a full introduction to Functional concepts. But it will give you some inspiration, and some jumping-off points for further exploration.

This course is a Graceful.Dev Garden Path, which means it is a guided pathway through a collection of (mostly) self-contained topics. Its status is: growing, meaning that there is a significant amount of material here already, and more is expected in the future.

Prerequisites: A working knowledge of Ruby is needed for this path. Functional Ruby is also part of the Ruby Fluency Garden Tour.

Not Enrolled

Course Includes

  • 2 Modules
  • 12 Topics