OCaml

例外

(* 適当に例外を3つ宣言。楽でいいですね。 *) # exception E1;; exception E1 # exception E2;; exception E2 # exception E3;; exception E3 (* 例外を発生させるだけの子。 *) # let foo = function | 1 -> raise E1 | 2 -> raise E2 | 3 -> raise E3 | o…

レコード型

なんでOCamlのレコード型のフィールド名はみんな同じ空の下で管理されるんだろう。 # type a = { id : string; name : string };; type a = { id : string; name : string; } # type b = { id : string; value : int };; type b = { id : string; value : in…