Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
let x = 4
let y = x + 6
let f z = x + z * y
let t = (f 3) + x
let g x y = x + y
let () =
Printf.printf "%d\n" (g x y);
if g (x+1) (y-2) = 0 then Printf.printf "OK\n"
let f x y =
let z = x * x in y * (z + z)
let x = 10
let y =
let x = "bonjour" in
x ^ x
let z = x + 3
let rec fact x =
if x = 0 then 1
else x * fact (x - 1)
let () = Printf.printf "%d\n" (fact 5)
let compte x =
let rec cpt y =
if y <= x then
begin
Printf.printf "%d " y;
cpt (y + 1)
end
in
cpt 1
let rec somme f n = if n<=0 then 0 else f n + somme f (n-1)
let g = somme (fun x-> x * x)
let () = Printf.printf "%d\n" (g 10)
let f1 x f = if x > 0 then f x else "OK"
let f2 x = x
let f3 f g x = f (g x)
let u = (1, 2)
let f (x, y, z) w = if x < y then w + 10 else z
let rec division n m =
if n < m then (0, n)
else
let (q,r) = division (n - m) m in
(q + 1, r)
let v =
("Durand","Jacques",
("2 rue J.Monod", "Orsay Cedex", 91893),
(10,03,1967), "0130452637","0645362738")
type complexe = { re : float; im : float}
let v = { re = 1.3; im = 0.9}
let add v1 v2 =
{ re = v1.re +. v2.re;
im = v1.im +. v2.im }
let conjuge z = { z with im = -. z.im }
type t = V | N of int * t
let l1 = N(1, N(2, N(3, V)))
let rec f l =
match l with
| V -> 0
| N(x, s) -> x + f s
let r = f l1
let l = [4; 1; 3; 6; 2; 3]
let rec longueur l =
match l with
| [] -> 0
| _ :: s -> 1 + longueur s
let rec recherche n l =
match l with
| [] -> false
| x :: s -> x = n || recherche n s
let rec append l1 l2 =
match l1 with
| [] -> l2
| x :: s -> x :: append s l2
type boolean = Vrai | Faux