Skip to content

Instantly share code, notes, and snippets.

@akimacho
Created March 2, 2015 08:46
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save akimacho/bd472f0bc8f05a7288fe to your computer and use it in GitHub Desktop.
第6章練習問題
(* --- 第6章問題 --- *)
(* 1. 型エラー *)
(* 関数squareにはint型値が渡されないといけない *)
# let square x = x * x ;;
val square : int -> int = <fun>
# square 3. ;;
Error: This expression has type float but an expression was expected of type
int
(* 2. 未定義の変数 *)
(* 変数piが定義されていない *)
# let circle = 2. *. pi *. r ;;
Error: Unbound value pi
(* 3. 構文エラー *)
(* "関数名は,変数名と同様にアルファベットの小文字で始まらなくてはなりません。"p.20 *)
(* 上の規則により,構文エラーが出たと考えられる *)
# let TV bangumi youbi = bangumi ^ "" ^ youbi ^ "に放映です." ;;
Error: Syntax error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment