美文网首页
柯里化练习

柯里化练习

作者: lehuai | 来源:发表于2018-01-03 13:56 被阅读0次

    CurryingDemo.scala

    package day04
    
    //object Context {
    //  implicit val a = "java"
    //  implicit val b = "python"
    //}
    object CurryingDemo {
    
      def m1(str: String)(implicit name: String) = {
        str + name
      }
      def main(args: Array[String]): Unit = {
    //    val func = m1("Hi--") _
    //    import Context.a
        import Context.b
    
        println(m1("Hi--"))
    //    println(func)
      }
    }
    
    

    Context.scala

    package day04
    
    object Context {
      implicit val a = "java"
      implicit val b = "python"
    

    相关文章

      网友评论

          本文标题:柯里化练习

          本文链接:https://www.haomeiwen.com/subject/gjyhnxtx.html