Ky Leggiero
12/01/2019, 3:52 AMiex
12/01/2019, 11:05 AMiex
12/01/2019, 11:06 AMKy Leggiero
12/07/2019, 6:38 AMdmitry.petrov
12/07/2019, 6:54 AMdmitry.petrov
12/07/2019, 7:16 AMxs |> List.filter foo |> List.map bar
Here filter
and map
take list as a last argument, so it's easy and natural to build pipelines using |>
operator (which is defined simply as let (|>) x f = f x
).
In Kotlin, filter
and map
are extension functions on receiver of type List<T>
, so it's easy and natural to build pipelines using call chains:
xs.filter(::foo).map(::bar)
It's not quite practical to use currying-based pipelines when all your standard library is designed with extension functions and call chains in mind, and vice versa.
In languages like Scala there's a considerable deal of special syntax to build functions out of functions (here by "special syntax" I mean stuff like _
arguments; of cause, it also has a lot of function composition operators in libraries).