Skip to content

Instantly share code, notes, and snippets.

@comfly
Last active April 21, 2016 14:57
Show Gist options
  • Save comfly/3934902c878483a2f48f57f43cc3bb5b to your computer and use it in GitHub Desktop.
Save comfly/3934902c878483a2f48f57f43cc3bb5b to your computer and use it in GitHub Desktop.
import Foundation
infix operator <| { associativity right precedence 95 }
func <|<A, R>(@noescape f: A -> R, a: A) -> R {
return f(a)
}
func <|<A, B, R>(@noescape f: (A, B) -> R, a: (A, B)) -> R {
return f(a.0, a.1)
}
let a = (10, "String")
func f(a: (Int, String)) -> String {
return "TUPLE"
}
func f(a: Int, _ b: String) -> String {
return "2ARY"
}
let k = f(_:_:) <| a
print(k)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment