Chapter 9 Lists

「Chapter 9 Lists」の編集履歴(バックアップ)一覧に戻る
Chapter 9 Lists」を以下のとおり復元します。
* Chapter 9 Lists

Lists are an important data structure in many Scala programs. A list containing the elements x1 , . . . , xn is written List(x1 , ..., xn ). Examples are: 

リストは多くの Scala プログラムで重要なデータ構造です。要素 x1,...,xn を含むリストは List(x1,...,xn) と書きます。例は

 val fruit = List("apples", "oranges", "pears") 
 val nums = List(1, 2, 3, 4) 
 val diag3 = List(List(1, 0, 0), List(0, 1, 0), List(0, 0, 1)) 
 val empty = List() 

Lists are similar to arrays in languages such as C or Java, but there are also three important differences. First, lists are immutable. That is, elements of a list cannot be changed by assignment. Second, lists have a recursive structure, whereas arrays are flat. Third, lists support a much richer set of operations than arrays usually do. 

リストは C や Java などの言語の配列と似ていますが、3つの重要な違いがあります。第一にリストは不変 (immutable) です。すなわちリストの要素は代入で変更出来ません。第二にリストは再帰的な構造を持っていますが、配列はフラットです。第三にリストは配列が通常持っているよりずっと豊かな操作の集合をサポートしています。

- [[9.1 Using Lists>Example9.1]]
- [[9.2 Definition of class List I: First Order Methods>Example9.2]]
- [[9.3 Example: Merge sort>Example9.3]]
- [[9.4 Definition of class List II: Higher-Order Methods>Example9.4]]
- [[9.5 Summary>Example9.5]]
----
#comment

復元してよろしいですか?

ツールボックス

下から選んでください:

新しいページを作成する
ヘルプ / FAQ もご覧ください。