# 鞣製（Curry）

``def sum(a: Int, b: Int) = a + bprintln(sum(1, 2))    // 顯示 3``

``def sum(a: Int)(b: Int) = a + bprintln(sum(1)(2))    // 顯示 3``

``def sum(a: Int) = (b: Int) => a + bprintln(sum(1)(2))    // 顯示 3``

``def sum(a: Int)(b: Int) = a + bval s = sum(1)        // 這是錯的 missing arguments for method sum``

``def sum(a: Int)(b: Int) = a + bval s = sum(1)_println(s(2))       // 顯示 3``

``println("XD")println{"XD"}``

``def sum(a: Int)(b: Int) = a + bprintln(sum(1)(2))    // 顯示 3println(sum(1){2}))    // 顯示 3``

``def unless(cond: Boolean, expr: => Any) = {    if(!cond) {        expr    }}``

``def unless(cond: Boolean)(expr: => Any) = {    if(!cond) {        expr    }}``

``val flag = falseunless(flag) {    println("XD")    println("Orz")}``

``def until(cond: => Boolean, expr: => Unit) {    if(!cond) {        expr        until(cond, expr)    }}``

``def until(cond: => Boolean)(expr: => Unit) {    if(!cond) {        expr        until(cond)(expr)    }}``

``var count = 10until(count == 0) {    println(count)    count -= 1}``

``def sum(numbers: Int*) = (0 /: numbers) {_ + _}println(sum(1, 2))         // 顯示 3``