vault backup: 2023-09-15 14:39:17

This commit is contained in:
2023-09-15 14:39:17 +02:00
parent 1d890744fd
commit b5ec7a1ce4
3 changed files with 13 additions and 7 deletions

View File

@ -94,3 +94,11 @@ val add : int -> bool = <fun>
val even : int -> bool = <fun>
```
An accumulator is a thing that try to get our result. In CAML we trying to not use an accumulator in our program. In CAML the syntax for the accumulator (`inv`) is: (exemple with reverse_int exercise. See 4.9 - b)
```Ocaml
# let reverse_int =
let rec rev inv = function
| 0 -> inv
| n -> rev (inv*10 + n mod 10)(n/10)
in rev 0 n;;
```