Tuesday, April 10, 2018

Overture: a Swift Library for Function Composition

Point-Free (via Matthew Johnson):

This library was created as an alternative to swift-prelude, which provides these tools (and more) using infix operators. For example, pipe is none other than the arrow composition operator >>>, which means the following are equivalent:

xs.map(incr >>> square)
xs.map(pipe(incr, square))

We know that many code bases are not going to be comfortable introducing operators, so we wanted to reduce the barrier to entry for embracing function composition.

Comments RSS · Twitter

Leave a Comment