(* Exercice 1 *)

let rec invnaif l =
	let rec perm c l = match l with
		| [] -> 0
		| h::t -> if c > h then (perm c t) + 1 else (perm c t) in
 	match l with
	| [] -> 0
	| h::t -> (perm h t) + (invnaif t);;

invnaif [3;2;1];;

(* Exercice 2 *)

let scinder l =
	let rec aux acc1 c l = match l with
		| [] -> ((List.rev acc1), [])
		| h::t when c=0 -> ((List.rev acc1), t)
		| h::t -> aux (h::acc1) (c-1) t
		in
	aux [] ((List.length l)/2) l ;;
scinder [1;2;3;4;5;6;7];;

