Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@akimacho
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akimacho/3175d98c34e17254189b to your computer and use it in GitHub Desktop.
Save akimacho/3175d98c34e17254189b to your computer and use it in GitHub Desktop.
第3章練習問題
(* --- 問題3.1 --- *)
# let e = 2.7182 ;;
val e : float = 2.7182
# let positive = e > 0.0 ;;
val positive : bool = true
# let seconds_of_day = 60 * 60 * 24 ;;
val seconds_of_day : int = 86400
(* みょうがだにと読む *)
(* 著者が所属するお茶の水女子大学に近いからか *)
# let name = "茗荷谷駅" ;;
val name : string = "茗荷谷駅"
(* --- 問題3.2 --- *)
(* 積のほうが優先順位が高いので,1.0 +. ( e *. 2.0 ) *)
(* 変数が値に置き換わるので,1.0 +. ( 2.7182 *. 2.0 ) *)
(* よって計算すると,1.0 +. 5.4364 *)
(* 以上より,6.4364 *)
# 1.0 +. e *. 2.0 ;;
- : float = 6.4364
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment