vault backup: 2023-09-12 15:26:21
This commit is contained in:
parent
32c1a6dec9
commit
615167f073
20
.obsidian/workspace.json
vendored
20
.obsidian/workspace.json
vendored
@ -13,7 +13,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "markdown",
|
"type": "markdown",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Chapter 0 - A bit of imperative/0.1 - Print.md",
|
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||||
"mode": "source",
|
"mode": "source",
|
||||||
"source": false
|
"source": false
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "backlink",
|
"type": "backlink",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Chapter 0 - A bit of imperative/0.1 - Print.md",
|
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||||
"collapseAll": false,
|
"collapseAll": false,
|
||||||
"extraContext": false,
|
"extraContext": false,
|
||||||
"sortOrder": "alphabetical",
|
"sortOrder": "alphabetical",
|
||||||
@ -102,7 +102,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outgoing-link",
|
"type": "outgoing-link",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Chapter 0 - A bit of imperative/0.1 - Print.md",
|
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||||
"linksCollapsed": false,
|
"linksCollapsed": false,
|
||||||
"unlinkedCollapsed": true
|
"unlinkedCollapsed": true
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@
|
|||||||
"state": {
|
"state": {
|
||||||
"type": "outline",
|
"type": "outline",
|
||||||
"state": {
|
"state": {
|
||||||
"file": "Algo/Chapter 0 - A bit of imperative/0.1 - Print.md"
|
"file": "Algo/Séminaire/Chapter 4 - A bit of imperative.md"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -158,19 +158,21 @@
|
|||||||
},
|
},
|
||||||
"active": "c82ce15f72f65a11",
|
"active": "c82ce15f72f65a11",
|
||||||
"lastOpenFiles": [
|
"lastOpenFiles": [
|
||||||
"Algo/Séminaire/Exercices seminaire.md",
|
|
||||||
"Algo/Chapter 0 - A bit of imperative/0.1 - Print.md",
|
"Algo/Chapter 0 - A bit of imperative/0.1 - Print.md",
|
||||||
|
"Algo/Séminaire/Chapter 4 - A bit of imperative.md",
|
||||||
|
"Algo/Séminaire/Untitled",
|
||||||
|
"Algo/Séminaire/Introduction.md",
|
||||||
|
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||||
|
"Algo/Séminaire/Chapter 2 - Functions.md",
|
||||||
|
"Mathématiques/Séminaire/Logics/Logics.md",
|
||||||
|
"Algo/Séminaire/Exercices seminaire.md",
|
||||||
"Algo/Chapter 0 - A bit of imperative",
|
"Algo/Chapter 0 - A bit of imperative",
|
||||||
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||||
"README.md",
|
"README.md",
|
||||||
"Algo/Séminaire/Weird stuff.md",
|
"Algo/Séminaire/Weird stuff.md",
|
||||||
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
|
||||||
"Algo/Séminaire/Chapter 2 - Functions.md",
|
|
||||||
"Algo/Séminaire/Introduction.md",
|
|
||||||
"Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg",
|
"Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg",
|
||||||
"Algo/Séminaire/assets",
|
"Algo/Séminaire/assets",
|
||||||
"Algo/Séminaire/assets/F1D2AA19-E790-4022-AFFF-F778EAB28AB5.jpg",
|
"Algo/Séminaire/assets/F1D2AA19-E790-4022-AFFF-F778EAB28AB5.jpg",
|
||||||
"Mathématiques/Séminaire/Logics/Logics.md",
|
|
||||||
"Algo/Séminaire",
|
"Algo/Séminaire",
|
||||||
"Untitled.canvas",
|
"Untitled.canvas",
|
||||||
"Mathématiques/Séminaire/Logics/Pasted image 20230904102817.png",
|
"Mathématiques/Séminaire/Logics/Pasted image 20230904102817.png",
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
If we want to print something in CAML, we have to use this structure
|
|
||||||
|
|
||||||
```Ocaml
|
|
||||||
# print_string "Hello World!";;
|
|
||||||
Hello! - : unit=()
|
|
||||||
|
|
||||||
# print_int ;;
|
|
||||||
-: int -> unit = <fun>
|
|
||||||
|
|
||||||
(*expression*)
|
|
||||||
# print_[type] [things to print];;
|
|
||||||
[things to print] -: unit=()
|
|
||||||
```
|
|
||||||
|
|
||||||
[](https://mermaid.live/edit#pako:eNpFjsEKwjAQRH8lLOLJ_kAPguixvejReFiSrQ002bJuUCn9d9OKOKfhMczMBI49QQ3dwE_Xo6hpzjaZouOhbUxVGcdxDAMVuzebq7ktjF7kVvBQTB7FV5x1zGq2f0IiLLCDSBIx-LIxLcUWtKdIFupiPXWYB7Vg01yimJUv7-SgVsm0gzx6VDoFvAvGHyQflKX93l7fzx9XV0DK)
|
|
||||||
|
|
43
Algo/Séminaire/Chapter 4 - A bit of imperative.md
Normal file
43
Algo/Séminaire/Chapter 4 - A bit of imperative.md
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
## 0.1. Print
|
||||||
|
If we want to print something in CAML, we have to use this structure
|
||||||
|
|
||||||
|
```Ocaml
|
||||||
|
# print_string "Hello World!";;
|
||||||
|
Hello! - : unit=()
|
||||||
|
|
||||||
|
# print_int ;;
|
||||||
|
-: int -> unit = <fun>
|
||||||
|
|
||||||
|
(*expression*)
|
||||||
|
# print_[type] [things to print];;
|
||||||
|
[things to print] -: unit=()
|
||||||
|
```
|
||||||
|
|
||||||
|
**Difference between compiler and interpreter for print**
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
|
||||||
|
A[CAML] -- compile --> B[ ] -- exec --> C[standard output] & D[standard error] ~~~ E(on your terminal)
|
||||||
|
```
|
||||||
|
```mermaid
|
||||||
|
flowchart LR
|
||||||
|
|
||||||
|
A[CAML] -- interpreter --> B[standard error] & C[standard output] & D[CAML answer] ~~~ E(in the interpreter interface)
|
||||||
|
```
|
||||||
|
|
||||||
|
**To print something and create a new line for the CAML evaluation**
|
||||||
|
```Ocaml
|
||||||
|
# print_endline "toto";;
|
||||||
|
toto
|
||||||
|
-: unit = ()
|
||||||
|
```
|
||||||
|
**To just print a newline**
|
||||||
|
```Ocaml
|
||||||
|
# print_newline();;
|
||||||
|
-: unit = ()
|
||||||
|
```
|
||||||
|
|
||||||
|
## 0.2. Sequence of prints
|
||||||
|
```Ocaml
|
||||||
|
# print_string "The answer is: "; print_int 42;;
|
||||||
|
The answer is: 42 -: unit = ()
|
Loading…
x
Reference in New Issue
Block a user