vault backup: 2023-09-07 21:25:19
This commit is contained in:
parent
a61d373d4c
commit
1e0b99b364
14
.obsidian/workspace.json
vendored
14
.obsidian/workspace.json
vendored
@ -13,7 +13,7 @@
|
||||
"state": {
|
||||
"type": "markdown",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||
"mode": "source",
|
||||
"source": false
|
||||
}
|
||||
@ -85,7 +85,7 @@
|
||||
"state": {
|
||||
"type": "backlink",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||
"collapseAll": false,
|
||||
"extraContext": false,
|
||||
"sortOrder": "alphabetical",
|
||||
@ -102,7 +102,7 @@
|
||||
"state": {
|
||||
"type": "outgoing-link",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||
"linksCollapsed": false,
|
||||
"unlinkedCollapsed": true
|
||||
}
|
||||
@ -125,7 +125,7 @@
|
||||
"state": {
|
||||
"type": "outline",
|
||||
"state": {
|
||||
"file": "Algo/Séminaire/Chapter 3 - Case analysis.md"
|
||||
"file": "Algo/Séminaire/Chapter 1 - CAML basics.md"
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -148,11 +148,11 @@
|
||||
},
|
||||
"active": "bdba25946b821d06",
|
||||
"lastOpenFiles": [
|
||||
"Algo/Séminaire/Exercices seminaire.md",
|
||||
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||
"Algo/Séminaire/Chapter 2 - Functions.md",
|
||||
"Algo/Séminaire/Introduction.md",
|
||||
"Algo/Séminaire/Chapter 1 - CAML basics.md",
|
||||
"Algo/Séminaire/Chapter 3 - Case analysis.md",
|
||||
"Algo/Séminaire/Exercices seminaire.md",
|
||||
"Algo/Séminaire/assets/69E2987C-209A-48CD-8964-5A60462966E5.jpg",
|
||||
"Algo/Séminaire/assets",
|
||||
"Algo/Séminaire/assets/F1D2AA19-E790-4022-AFFF-F778EAB28AB5.jpg",
|
||||
|
@ -95,7 +95,37 @@ val f : int -> int = <fun>
|
||||
```Ocaml
|
||||
# let and_ a b =
|
||||
match a with
|
||||
true -> match b with
|
||||
true -> (match b with
|
||||
true -> true
|
||||
| false -> false
|
||||
| false -> false)
|
||||
| false -> false;;
|
||||
```
|
||||
|
||||
> ⚠️ If you forgot the parentheses, Caml will belived the two `|false` belong to the same pattern matching
|
||||
|
||||
### Universal pattern
|
||||
```Ocaml
|
||||
# let f x = match x with
|
||||
0 -> 18
|
||||
| 1 -> 24
|
||||
| _ -> x*x ;;
|
||||
```
|
||||
|
||||
### "Or" filter
|
||||
```Ocaml
|
||||
let f x match x with
|
||||
0 | 20 -> 18
|
||||
| 1 | 11 | 12 -> 24
|
||||
|_ -> x * x ;;
|
||||
```
|
||||
|
||||
### Guarded filters
|
||||
```Ocaml
|
||||
let sign x = match x with
|
||||
0 -> 0
|
||||
| y when y < 0 -> -1
|
||||
| _ -> 1
|
||||
```
|
||||
|
||||
> `y when y<0` is an evaluation
|
||||
|
||||
|
@ -4,11 +4,10 @@
|
||||
- The goal is to take an input and give an output with the solution
|
||||
|
||||
## How to write an algorithm
|
||||
1) What :
|
||||
- What do you have available ; What is the output that your searching for => this is call specifications
|
||||
- How : find resolution methods and choose the best one
|
||||
- Formalism : shape it like a computer talk
|
||||
- Translate :
|
||||
1) What do you have available ; What is the output that your searching for => this is call specifications
|
||||
2) How : find resolution methods and choose the best one
|
||||
3) Formalism : shape it like a computer talk
|
||||
4) Translate :
|
||||
|
||||
## Compilation and interpretation
|
||||
### Compiler
|
||||
|
Loading…
x
Reference in New Issue
Block a user