Scala
複数のデータ型を有するリストを作成することも可能。
scala> val a = List(1, 2) a: List[Int] = List(1, 2) scala> val a = List(1, "hoge") a: List[Any] = List(1, hoge)
Haskell
https://www.shido.info/hs/haskell4.html#list
リストの要素の型はすべて同じ必要がある。
Prelude> let a = [1,2] Prelude> a [1,2] Prelude> :t a a :: [Integer] Prelude> let a = [1,"hoge"] <interactive>:7:10: No instance for (Num [Char]) arising from the literal `1' Possible fix: add an instance declaration for (Num [Char]) In the expression: 1 In the expression: [1, "hoge"] In an equation for `a': a = [1, "hoge"]