Created
November 4, 2011 10:02
-
-
Save gakuzzzz/1339030 to your computer and use it in GitHub Desktop.
Tupeの連結
This file contains 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
trait TupleOr { | |
implicit def tuple1Or[A](t: (A, )) = new { | |
def ++[B](o: (B, )) = (t._1, o._1) | |
def ++[B, C](o: (B, C)) = (t._1, o._1, o._2) | |
def ++[B, C, D](o: (B, C, D)) = (t._1, o._1, o._2, o._3) | |
def ++[B, C, D, E](o: (B, C, D, E)) = (t._1, o._1, o._2, o._3, o._4) | |
def ++[B, C, D, E, F](o: (B, C, D, E, F)) = (t._1, o._1, o._2, o._3, o._4, o._5) | |
// ... | |
} | |
implicit def tuple2Or[A, B](t: Tuple2[A, B]) = new { | |
def ++[C](o: (C, )) = (t._1, t._2, o._1) | |
def ++[C, D](o: (C, D)) = (t._1, t._2, o._1, o._2) | |
def ++[C, D, E](o: (C, D, E)) = (t._1, t._2, o._1, o._2, o._3) | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment