vault backup: 2023-09-05 21:35:41
This commit is contained in:
parent
633eb688ba
commit
3b44f8c8fd
@ -55,13 +55,13 @@ val name: type of evaluation
|
|||||||
### Local definitions
|
### Local definitions
|
||||||
```Ocaml
|
```Ocaml
|
||||||
# let r = 1. in let pi = 3.14 in 2*pi*r;;
|
# let r = 1. in let pi = 3.14 in 2*pi*r;;
|
||||||
_ : float = 6.28
|
- : float = 6.28
|
||||||
|
|
||||||
# let x = 10 in y = 2*x in x+y;;
|
# let x = 10 in y = 2*x in x+y;;
|
||||||
_ : float = 30
|
- : float = 30
|
||||||
|
|
||||||
# x;;
|
# x;;
|
||||||
_ : int =2 (*see global definition section*)
|
- : int =2 (*see global definition section*)
|
||||||
|
|
||||||
# pi;;
|
# pi;;
|
||||||
error: unbound value pi
|
error: unbound value pi
|
||||||
@ -72,7 +72,7 @@ when there is the keyword ``len``and ``in`` that create a local definition. A lo
|
|||||||
### Multiple definitions
|
### Multiple definitions
|
||||||
```Ocaml
|
```Ocaml
|
||||||
# let r = 1. and pi : 3.14 in 2 *. pi *. r;; (*local version*)
|
# let r = 1. and pi : 3.14 in 2 *. pi *. r;; (*local version*)
|
||||||
_ : float = 6.28
|
- : float = 6.28
|
||||||
|
|
||||||
# let x = 1.2 and y = "Hello";;
|
# let x = 1.2 and y = "Hello";;
|
||||||
val x: float = 1.2 (*our current env is x -> 3 ; y -> 1 ; x -> 1.2 *)
|
val x: float = 1.2 (*our current env is x -> 3 ; y -> 1 ; x -> 1.2 *)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user