「Example9.5」の編集履歴(バックアップ)一覧はこちら
Example9.5 - (2011/02/24 (木) 08:47:51) の1つ前との変更点
追加された行は緑色になります。
削除された行は赤色になります。
#co(){
9.5 Summary
This chapter has introduced lists as a fundamental data structure in programming. Since lists are immutable, they are a common data type in functional programming languages. They have a role comparable to arrays in imperative languages. However, the access patterns between arrays and lists are quite different. Where array accessing is always done by indexing, this is much less common for lists. We have seen that scala.List defines a method called apply for indexing however this operation is much more costly than in the case of arrays (linear as opposed to constant time). Instead of indexing, lists are usually traversed recursively, where recursion steps are usually based on a pattern match over the traversed list. There is also a rich set of higher-order combinators which allow one to instantiate a set of predefined patterns of computations over lists.
}
** 9.5 まとめ
この章では、リストをプログラミングの基本的なデータ構造として紹介しました。リストはイミュータブル(変更不能)なので、関数型プログラミング言語では一般的なデータ型です。命令型言語における配列に匹敵する役割を持っています。しかし配列とリストではアクセス方法に大きな違いがあります。配列へのアクセスは常にインデックスによりますが、リストではインデックスは滅多に使いません。scala.List にはインデックスによるアクセスのための apply メソッドが定義されていましたが、この操作は配列の場合よりずっとコストがかかります (一定時間に対して線形)。通常、リストはインデックスの代わりに再帰的にアクセスされ、再帰のステップは、たいていの場合、リスト上のパターンマッチに基づきます。また、豊富な高階コンビネータ群により、リストに対する事前定義された計算パターンをインスタンス化できます。
#center(){[[前ページ>Example9.4]] [[ 9 章>Chapter 9 Lists]] [[目次>ScalaByExample和訳]] [[次ページ>Chapter 10 For-Comprehensions]]}
----
#comment
#co(){
9.5 Summary
This chapter has introduced lists as a fundamental data structure in programming. Since lists are immutable, they are a common data type in functional programming languages. They have a role comparable to arrays in imperative languages. However, the access patterns between arrays and lists are quite different. Where array accessing is always done by indexing, this is much less common for lists. We have seen that scala.List defines a method called apply for indexing however this operation is much more costly than in the case of arrays (linear as opposed to constant time). Instead of indexing, lists are usually traversed recursively, where recursion steps are usually based on a pattern match over the traversed list. There is also a rich set of higher-order combinators which allow one to instantiate a set of predefined patterns of computations over lists.
}
#setmenu2(ex-r-menu)
** 9.5 まとめ
この章では、リストをプログラミングの基本的なデータ構造として紹介しました。リストはイミュータブル(変更不能)なので、関数型プログラミング言語では一般的なデータ型です。命令型言語における配列に匹敵する役割を持っています。しかし配列とリストではアクセス方法に大きな違いがあります。配列へのアクセスは常にインデックスによりますが、リストではインデックスは滅多に使いません。scala.List にはインデックスによるアクセスのための apply メソッドが定義されていましたが、この操作は配列の場合よりずっとコストがかかります (一定時間に対して線形)。通常、リストはインデックスの代わりに再帰的にアクセスされ、再帰のステップは、たいていの場合、リスト上のパターンマッチに基づきます。また、豊富な高階コンビネータ群により、リストに対する事前定義された計算パターンをインスタンス化できます。
#center(){[[前ページ>Example9.4]] [[ 9 章>Chapter 9 Lists]] [[目次>ScalaByExample和訳]] [[次ページ>Chapter 10 For-Comprehensions]]}
----
#comment