Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1=2;;
- `a`=`b`;;
- 1=2 or 1<2;;
- 1<>2 || not 1=2;;
- 1=1 && 2=2;;
- 1=1 & 2=2;;
- 3+5;;
- 3*5;;
- 3.*.5.;;
- 3/5;;
- 1073741824+1;;
- exp(1.)+.exp(-1.);;
- 3.*.0.5;;
- 'a';;
- `a`;;
- "bonjour" ^ "les enfants";;
- hd [1,2,3];;
- [|1;`a`; 1a |];;
- [|1;2;3|];;
- 0::[|1;2;3|];;
- [|1;3;4|].(0);;
- hd [1;2;3];;
- tl [1;2;4;5;2;3];;
- [1;2;3].(2);;
- let x=1 in 2+x;;
- let x=1;;
- x;;
- 2*x where x=3;;
- let (x,y)=(1,2) in x+y;;
- let x=1 and y=2 in x+y;;
- let f1= function x->x*x;;
- f1(3);;
- let f2= fun x->x*x;;
- f2(2);;
- let f3 x=x*x;;
- f3 3;;
- let p1(x,y)=x*y;;
- p1(2, 4);;
- let p2 x y=x*y;;
- p2(3, 4);;
- let p3=function(x,y)->x*y;;
- p3(2, 4);;
- let x=1;;
- let f=fun y->x+y;; f(2);;
- let x=ref(0);;
- x:=!x+1;;
- x;;
- (*Exercice 3*)
- log(2.71);;
- exp(2.)*.log(3.)/.(cos(1.)*.cos(1.));;
- let ch = function x->(exp(x)+.exp(-1.*.x))/.2.;;
- ch(1.);;
- (*Exerice 4*)
- let P1 = (1=1);;
- let P2 = (2=2);;
- let xor = fun x y-> (x || y) && not (y && x);;
- let xor2 = function(x, y)-> (x || y) && not (y && x);;
- xor P1 P2;;
- xor2 (P1, P2);;
- (P1 || P2) && not (P1 && P2);;
- (*Exercice 5*)
- let rec ari a r n = if n = 0 then a else (ari a r (n-1)) + r;;
- ari 0 2 3;;
Advertisement
Add Comment
Please, Sign In to add comment