// Just a quick test/exploration of Pimp My Library to reproduce the syntax of the C++ et al ternary operator


object TernaryOp {
implicit def fakeTernary[A](a:(A,A)) = new{
def ?:(p:Boolean)=if(p) a._1 else a._2
}
//Before adding the Tuplicator class the compiler got very confused
// between anonymous classes
class Tuplicator[A](a:A){
def ~:(b:A) = (b,a)
}
implicit def tuplicate[A](a:A) = new Tuplicator(a)
}

object TernaryTest {
import TernaryOp._
def main(args: Array[String]) = {
println( (1>3) ?: 1 ~: 3 )
}
}

Buy oxycodone without a prescription

Read more: http://feeds.dzone.com/~r/dzone/snippets/~3/HqndTGH8Jk4/12193