trait Concat
[A
] { def ++
(x
: A, y
: A
): A
} override def ++
(x
: Int, y
: Int
): Int
= (x.
toString + y.
toString).
toInt }
def ++
(y
: A
) = implicitly
[Concat
[A
]].++
(x, y
) }
def main
(args
: Array
[String
]): Unit
= {
println(c)
val d
= highOrderTest
(a, b
)(IntConcat.++
)
println(d)
}
def highOrderTest
[A
](x
: A, y
: A
)(fun
: (A, A
) => A
) = fun
(x, y
)
}
b2JqZWN0IE1haW4gewoJCgl0cmFpdCBDb25jYXRbQV0geyBkZWYgKysgKHg6IEEsIHk6IEEpOiBBIH0KCWltcGxpY2l0IG9iamVjdCBJbnRDb25jYXQgZXh0ZW5kcyBDb25jYXRbSW50XSB7CgkJb3ZlcnJpZGUgZGVmICsrICh4OiBJbnQsIHk6IEludCk6IEludCA9ICh4LnRvU3RyaW5nICsgeS50b1N0cmluZykudG9JbnQKCX0KCQoJaW1wbGljaXQgY2xhc3MgQ29uY2F0T3BlcmF0b3JzW0E6IENvbmNhdF0oeDogQSkgewoJCWRlZiArKyAoeTogQSkgPSBpbXBsaWNpdGx5W0NvbmNhdFtBXV0uKysoeCwgeSkKCX0KCQoJZGVmIG1haW4oYXJnczogQXJyYXlbU3RyaW5nXSk6IFVuaXQgPSB7CgkJdmFsIGEgPSAxMjM0CgkJdmFsIGIgPSA3NjUKCQkKCQl2YWwgYyA9IGEgKysgYgoJCQoJCXByaW50bG4oYykKCQkKCQl2YWwgZCA9IGhpZ2hPcmRlclRlc3QoYSwgYikoSW50Q29uY2F0LisrKQoJCQoJCXByaW50bG4oZCkKCX0KCQoJZGVmIGhpZ2hPcmRlclRlc3RbQV0oeDogQSwgeTogQSkoZnVuOiAoQSwgQSkgPT4gQSkgPSBmdW4oeCwgeSkKCQp9