(*Constantes*) let a = [1;2;3;4;5];; let b = [12;4;6;9;15];; let rec succAll l = match l with [] -> [] | x::xs -> (x+1)::succAll xs ;; (*Teste da função succAll*) succAll [2;3;6;8;];; let rec belongs e l1 = match l1 with [] -> false | x::xs -> if (e=x) then true else belongs e xs ;; (*Teste do belongs*) belongs 15 b;; belongs 3 b;; belongs 5 [];; let rec union l1 l2 = match l1 with [] -> l2 | x::xs -> if belongs x l2 then union xs l2 else x::union xs l2 ;; (*Teste do union*) union a [3;4;5];; union b [];; union [] a;; union a b;; let rec inter l1 l2 = match l1 with [] -> [] | x::xs -> if belongs x l2 then x::(inter xs l2) else inter xs l2 ;; (*Teste do inter*) inter a b;; inter a [];; inter b [1;6;9];; let rec diff l1 l2 = match l1 with [] -> [] | x::xs -> if belongs x l2 then diff xs l2 else x:: diff xs l2 ;; (*teste do diff*) diff a b;; diff a [];; diff [1;2;3] [1;4;3;7];; (*FEITO PELO PROF*) let rec ins x ll= match ll with [] -> [x] | l::ls -> (x::l)::ins x ls ;; let rec power l = match l with [] -> [[]] | x::xs -> power xs @ ins x (power xs) ;;