(* calcul de la dérivée d'une fonction*) let fonction_derivee (f:float -> float) (h:float) : (float -> float) = (function: x -> ((f (x+.h)) -. (f x)) /. h);; (* calcul de la taille d'une liste *) let rec taille (l:'a list) : int = match l with [] -> 0 |x::suite -> 1 + (taille suite);; (* ajouter un élément à toutes les listes d'une liste de liste : aj_elem : 'a list list, 'a -> 'a list list aj_elem [[1;2;3];[];[4;5;6]] 9 = [[1;2;3;9];[9];[4;5;6;9]] *) let aj_elem (l:'a list list) (e:'a) : 'a list list = List.map (fun x -> x@[e]) l;; (* tout mettre en minuscule : minuscule "Un TexTe qui Melange MAJ et min" = "un texte qui melange maj et min"*) let minuscule (t: char list) : char list = List.map (fun c -> if ( (c>='A') && (c<='Z')) then char_of_int (((int_of_char c)-(int_of_char 'A'))+(int_of_char 'a')) else c) t;; (* Liste des personnes ayant réussi une UE : reussite [(12,"Anne");(6,"Bob");(19,"Charlie");(15;"David")] =["Anne";"echoue";"Charlie";"David"] *) let reussite (l:(int*string) list) : string list = List.map (fun x -> if ((fst x) >=10) then (snd x) else "non") l;;