2008-05-20から1日間の記事一覧

タプルと、case class を使った名前の後付け

Rainy Day Codings - Scala で怠惰なリテラル表記 タプルを使うとこんな感じで書ける object Main { def main(args : Array[String]): Unit = { val ls = List( ("Akira", 23, "Japan"), ("Johnny", 38, "America"), ("Millia", 16, "Russia") ) ls.foreach{…

Structual Subtyping

静的ダックタイピングのようなもの「Tはxxメソッドを持っていればいい型」のようなことができるベター Generics です object Foo { def name = "Foo" } object Bar { def name = "Bar" } object Main { def dispName(x :{def name: String}) = println(x.nam…

type alias

型に別名を付ける object Main { def main(args : Array[String]): Unit = { type StringEx = String // String に StringEx という別名を付ける val str: StringEx = "abc" println(str) } } object Main { def main(args : Array[String]): Unit = { type …

yield

object Main { def main(args : Array[String]): Unit = { val ls = for (i <- List.range(0, 10)) yield i + 1 ls.foreach(println) // 1, 2, 3...10 } }

JIS C++ の誤りについて

C++

JIS C++ の誤りについて、日本規格協会経由で指摘が来ました。 この件について、正誤表を出すことになるので、他にも誤りを 知っていたら教えてくださいとのことです。今回の正誤表では、本体(英文)の間違いは入れない。翻訳段階での 間違いのみ修正というこ…