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か?またはより理解しやすい方法?