scala> val mul =(x:Int,y:Int)=>x*y
mul:(Int, Int)=> Int =<function2>
scala> val mulOneATime =(x:Int)=>((y:Int)=>x*y)
mulOneATime: Int =>(Int => Int)=<function1>
scala>mulOneATime(6)(7)
res12: Int =42//柯里化简化版 方法
scala> def mulOneATime1 (x:Int)(y:Int)=x*y
mulOneATime1:(x: Int)(y: Int)Int
//柯里化函数版
scala> val mulOneATime2 =(x:Int)=>(y:Int)=>x*y
mulOneATime2: Int =>(Int => Int)=<function1>
柯里化把某个函数参数单独提出来,以提供更多用于类型推断的信息
_.equalsIgnoreCase(_)是一个经过柯里化的参数的形式传递
scala> val a =Array("hello","world")
a: Array[String]=Array(hello, world)
scala> val b =Array("Hello","world")
b: Array[String]=Array(Hello, world)
scala> a.corresponds(b)(_.equalsIgnoreCase(_))
res13: Boolean =true//corresponds源码
def corresponds[B](that: GenSeq[B])(p:(A,B)=> Boolean): Boolean ={
val i =this.iterator
val j = that.iterator
while(i.hasNext && j.hasNext)if(!p(i.next(), j.next()))returnfalse!i.hasNext &&!j.hasNext
}