Guest User

Untitled

a guest
Jun 24th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. infix operator |> { precedence 50 associativity left }
  2.  
  3. // Pipe forward: transform "x |> f" to "f(x)" and "x |> f |> g |> h" to "h(g(f(x)))"
  4. public func |> <T,U>(lhs: T, rhs: T -> U) -> U {
  5. return rhs(lhs)
  6. }
  7.  
  8. //Without the forward pipe
  9. let convertedImage = convertToGrayscale(image: adjustColors(image: image))
  10.  
  11. //With the forward pipe operator
  12. let convertedImage = image |> adjustColors |> convertToGrayscale
Add Comment
Please, Sign In to add comment