Created
February 15, 2015 18:49
-
-
Save kazk/4d1c22ed249e00353212 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
public func pipe<A,B,R>(a:(A)->B, b:(B)->R) -> (A)->R { | |
return {(x) in b(a(x))} | |
} | |
/// | |
public func pipe<A,B,C,R>(a:(A)->B, b:(B)->C, c:(C)->R) -> (A)->R { | |
return {(x) in c(b(a(x)))} | |
} | |
/// | |
public func pipe<A,B,C,D,R>(a:(A)->B, b:(B)->C, c:(C)->D, d:(D)->R) -> (A)->R { | |
return {(x) in d(c(b(a(x))))} | |
} | |
/// | |
public func pipe<A,B,C,D,E,R>(a:(A)->B, b:(B)->C, c:(C)->D, d:(D)->E, e:(E)->R) -> (A)->R { | |
return {(x) in e(d(c(b(a(x)))))} | |
} | |
/// | |
public func pipe<A,B,C,D,E,F,R>(a:(A)->B, b:(B)->C, c:(C)->D, d:(D)->E, e:(E)->F, f:(F)->R) -> (A)->R { | |
return {(x) in f(e(d(c(b(a(x))))))} | |
} | |
/// | |
public func pipe<A,B,C,D,E,F,G,R>(a:(A)->B, b:(B)->C, c:(C)->D, d:(D)->E, e:(E)->F, f:(F)->G, g:(G)->R) -> (A)->R { | |
return {(x) in g(f(e(d(c(b(a(x)))))))} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment