makotan _at_ gmail dot com

寒い・・・Scalaで暖まる・・・わけないだろ!

関数縛りにしてみたw
面倒だったから一部再利用だけど、そこもたぶん出来る気がする

  test("vfs write test func 04") {
    val (write,close) = txtFileWriterOpen(testFileName)
    List("data04-1","data04-2").map(write)
    close()
  }

  def txtFileWriterOpen(fileName:String) : ((String)=>Unit,()=>Unit) = {
    val tfw = TextFileWriter(fileName)
    def write(txt: String) : Unit = {
      tfw.write(txt)
    }

    def close() : Unit = {
      tfw.close()
    }
    (write,close)
  }