2011-08-01から1ヶ月間の記事一覧

ScalaでRubyのFile.joinみたいなのを実装

こんな感じで。 /** * 与えられた複数の文字列からファイルパスを作成する。 */ def createPath(pathes: String*): String = { import java.io.File pathes.foldLeft(""){(s, p) => (new File(s, p)).getAbsolutePath()} // ("" /: pathes){(s, p) => (new F…