Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
5
Task/Compound-data-type/OCaml/compound-data-type-1.ocaml
Normal file
5
Task/Compound-data-type/OCaml/compound-data-type-1.ocaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
type tree = Empty
|
||||
| Leaf of int
|
||||
| Node of tree * tree
|
||||
|
||||
let t1 = Node (Leaf 1, Node (Leaf 2, Leaf 3))
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-2.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-2.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
type point = { x : int; y : int }
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-3.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-3.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
let p = { x = 4; y = 5 }
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-4.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-4.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
p.x (* evaluates to 4 *)
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-5.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-5.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
type mutable_point = { mutable x2 : int; mutable y2 : int }
|
||||
3
Task/Compound-data-type/OCaml/compound-data-type-6.ocaml
Normal file
3
Task/Compound-data-type/OCaml/compound-data-type-6.ocaml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
let p2 = { x2 = 4; y2 = 5 } in
|
||||
p2.x2 <- 6;
|
||||
p2 (* evaluates to { x2 = 6; y2 = 5 } *)
|
||||
1
Task/Compound-data-type/OCaml/compound-data-type-7.ocaml
Normal file
1
Task/Compound-data-type/OCaml/compound-data-type-7.ocaml
Normal file
|
|
@ -0,0 +1 @@
|
|||
let p = (2,3)
|
||||
Loading…
Add table
Add a link
Reference in a new issue