代数的データ型(だいすうてきデータがた、英: algebraic data type)とはプログラミング、特に関数型プログラミングや型システムにおいて使われるデータ型である。それぞれの代数的データ型の値には、1個以上のコンストラクタがあり、各コンストラクタには0個以上の引数がある。 代数的データ型の値(データ)の感覚的な説明としては、引数で与えられた他のデータ型の値を、コンストラクタで包んだようなもの、である。コンストラクタに引数がある代数データ型は複合型(他のデータ型を組み合わせて形成する型)である。 概要[編集] Haskellにおける、葉に整数型の値を持つ(分岐は部分木しか持たない)、二分木の例で説明する。以下のようなdata宣言で、データ型を宣言する。 data Node = Leaf Integer | Branch Node Node deriving (Show) -- 表示
Enumerations[edit | edit source] One special case of the data declaration is the enumeration — a data type where none of the constructor functions have any arguments: data Month = January | February | March | April | May | June | July | August | September | October | November | December You can mix constructors that do and do not have arguments, but then the result is not called an enumeration. Th
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く