A new Swift video series exploring functional programming and more.
#11 • Monday Apr 9, 2018 • Subscriber-only

Composition without Operators

While we unabashedly promote custom operators in this series, we understand that not every codebase can adopt them. Composition is too important to miss out on due to operators, so we want to explore some alternatives to unlock these benefits.

#11 • Monday Apr 9, 2018 • Subscriber-only

Composition without Operators

While we unabashedly promote custom operators in this series, we understand that not every codebase can adopt them. Composition is too important to miss out on due to operators, so we want to explore some alternatives to unlock these benefits.


Subscribe to Point‑Free

This episode is for subscribers only. To access it, and all past and future episodes, become a subscriber today!

See subscription optionsorLog in

Sign up for our weekly newsletter to be notified of new episodes, and unlock access to any subscriber-only episode of your choosing!

Sign up for free episode

Introduction

Our series unabashedly promotes the use of custom operators, but they’re far from common in the Swift community. Our use of operators may even be the most controversial aspect of our series! We explored the “why” of operators in our first episode, and we continue to justify the operators we introduce with specific—maybe even rigorous—criteria, and while we may have you convinced, it’s another story to convince your coworkers! Your team may even adopt a style guide that prohibits it!

Operators shouldn’t be the bottleneck to introducing composition to your code. In this episode we’ll explore a few alternatives that may act as a more gentle introduction to the team and may even be the first step to getting your coworkers first-class tickets on the operator express!

Subscribe to Point-Free

👋 Hey there! Does this episode sound interesting? Well, then you may want to subscribe so that you get access to this episodes and more!


Exercises

  1. Write concat for functions (inout A) -> Void.

  2. Write concat for functions (A) -> A.

  3. Write compose for backward composition. Recreate some of the examples from our functional setters episodes (part 1 and part 2) using compose and pipe.


References

Chapters
Introduction
00:05
Outroducing |>
00:57
Outroducing >>>
03:22
Outroducing >=>
07:16
Outroducing <>
11:49
Algebraic properties
15:53
What’s the point?
19:21