This commit is contained in:
NoryiE
2025-02-16 14:12:49 +00:00
parent c6a89e5b35
commit e0aeb9b06e
2737 changed files with 5220 additions and 1039045 deletions

View File

@@ -1,23 +0,0 @@
utop # type person = { name: string ; age: int ; human : bool };;
type person = { name : string; age : int; human : bool; }
utop # let david = { name = "david" ; age = 32 ; human = false };;
val david : person = {name = "david"; age = 32; human = false}
utop # let mary = { david with name = "mary" };;
val mary : person = {name = "mary"; age = 32; human = false}
utop # let toggle_human (p : person) = { p with human = not p.human };;
val toggle_human : person -> person = <fun>
utop # let () =
let david' = toggle_human david in
if david'.human then
print_endline "david is human"
else
print_endline "david is not human"
;;
david is human
(** From https://o1-labs.github.io/ocamlbyexample/basics-records.html *)