7 let x0 () : int = 13 * 3 + 7 - 4
9 let x1 () : bool = 2 + 2 = 4
15 if !x <> 3 then 7 else 4
21 Cons 12 (Cons 34 (Cons 56 Nil)) ++ Cons 78 (Cons 90 Nil)
33 let search (t:map int int) (len:int) (v:int) : int =
36 if t[i] = v then raise (Found i)
42 constant t : map int int = (const 0)[0 <- 12][1 <- 42][2 <- 67]
44 let ghost test12 () = search t 3 12
45 let ghost test42 () = search t 3 42
46 let ghost test67 () = search t 3 67
47 let ghost test0 () = search t 3 0
55 type t = { mutable a : int; c: int ; mutable b : int }
58 let y = { a = 1; c = 43; b = 2 } in
62 let y = { a = 1; c = 43; b = 2 } in
68 let y = { a = 1; c = 43; b = 2 } in
69 y.a + y.b (* should be 3 *)
72 let y = { a = 1; c = 43; b = 2 } in
74 y.a + z.b (* should be 3 *)
77 let y = { a = 1; c = 43; b = 2 } in
79 y.a + y.b (* should be 5 *)
82 let y = { a = 1; c = 43; b = 2 } in
87 type refint = { mutable i : int }
89 let y () : refint = { i = 0 }
92 let r = { i = 0 } in r.i <- 42; r.i
103 s.i (* should be 55 *)
107 = let x = { i = 2 } in
109 let sum = { i = 0 } in
114 y.i <- 4 * y.i + tmp;
119 let run1 () = f 10 (* should be 10 *)
121 let run2 () = f 4000000 (* should be 4613732 *)
123 (* use of a global mutable variable *)
129 let j () = x.i <- 42; x.i
137 let y () : ref int = { contents = 0 }
140 let r = ref 0 in r := 42; !r
157 let run1 () = f 10 (* should be 10 *)
159 let run2 () = f 4000000 (* should be 4613732 *)
174 if n = 0 then 0 else h (n-1) + !x
178 (* use of a global ref *)
193 type t = { left : ref int ; middle : int; right : ref int }
195 let a () = { left = ref 13 ; middle = 5; right = ref 42 }
203 type u = { u1 : t ; u2 : t }
206 let x = { left = ref 1; middle = 2; right = ref 3} in
207 let y = { left = ref 4; middle = 5; right = ref 6} in
208 let u = { u1 = x ; u2 = y } in
221 let search (t:array int) (v:int) : int =
223 for i=0 to t.length - 1 do
224 if t[i] = v then raise (Found i)
230 let incr (t:array int) : unit =
231 for i=0 to t.length - 1 do
236 let t = Array.make 2 21 in
241 let t = Array.make 2 21 in
247 let t = Array.make 2 21 in
253 let t () : array int =
254 let t = Array.make 3 0 in
262 t[0] + t[1] + t[2] (* 121 *)
264 let i () = incr (t ())
266 let test12 () = search (t ()) 12
267 let test42 () = search (t ()) 42
268 let test67 () = search (t ()) 67
269 let test7 () = search (t ()) 7
275 let t = Array.make 3 0 in
284 let t = Array.make 3 0 in
285 for i=0 to 2 do t[i] <- i done;
286 t[0] + t[1] + t[2] (* 3 *)
292 let j () = g[0] <- 42