JasonHickeyのObjectiveCaml入門を学んでいます。表現のことについて質問してください。
だからそれは言う:
Definitions using let can also be nested using the in form.
let identifier = expression1 in expression2
The expression expression2 is called the body of the let. The variable named identifier
is defined as the value of expression1 within the body. The identifier is defined only in
the body expression2 and not expression1.
A let with a body is an expression; the value of a let expression is the value of
the body.
let x = 1 in
let y = 2 in
x + y;;
let z =
let x = 1 in
let y = 2 in
x + y;;
val z : int = 3
Ok。私は上記のステートメントについてあまり理解していません。
初め
The variable named identifier
is defined as the value of expression1 within the body. The identifier is defined only in
the body expression2 and not expression1.
これは何を意味するのでしょうか?identifier
ですがthe value of expression1
、体の中だけexpression2
ですか?identifier
それはでのみ有効ですexpression2
が、の価値があるという意味expression1
ですか?それでは、定義identifier
は意味がありexpression2
ますか?
2番
例を見てみましょう:
let x = 1 in
let y = 2 in
x + y;;
let
ですから、この声明の要点はわかりません。x = 1
確かに、体を与えることのポイントは何let y=2 in x+y;;
ですか?
第3
let z = let x = 1 in let y = 2 in x + y ;;
では、どうすればこのステートメントのロジックを整理できますか?
この定義形式を取る場合:let identifier = expression1 in expression2
expression1
上記のlet
ステートメントの内容は何ですか?それlet x = 1
ですか?
nesting let
誰かが私にある種の方法での論理を教えてもらえますJava
か?またはより理解しやすい方法?