Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- infix operator |> { precedence 50 associativity left }
- // Pipe forward: transform "x |> f" to "f(x)" and "x |> f |> g |> h" to "h(g(f(x)))"
- public func |> <T,U>(lhs: T, rhs: T -> U) -> U {
- return rhs(lhs)
- }
- //Without the forward pipe
- let convertedImage = convertToGrayscale(image: adjustColors(image: image))
- //With the forward pipe operator
- let convertedImage = image |> adjustColors |> convertToGrayscale
Add Comment
Please, Sign In to add comment