2008-12-09から1日間の記事一覧

むむむむむむむ

Scala scala> def mystery(lst : List[Int]) = | (List[Int]() /: lst) ((x, y) => if (y % 2 == 0) x else x + y) warning: there were deprecation warnings; re-run with -deprecation for details mystery: (List[Int])List[Int] scala> mystery(List(1,…

mkstring

Scala scala> val lst=List(1,2,3) lst: List[Int] = List(1, 2, 3) scala> lst.mkString("|") res17: String = 1|2|3 scala> lst.mkString("[", "|", "]") res18: String = [1|2|3] Ruby >> array=[1,2,3] => [1, 2, 3] >> array.join("|") => "1|2|3" >> "…