Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let rec ecrireListeDansChannel l c = match l with
- [] -> ()
- | x::r -> output_string c (x^"\n"); ecrireListeDansChannel r c;;
- let ecrireListeDansFichier l file =
- let channel = open_out file in
- ecrireListeDansChannel l channel;
- close_out channel;;
- ecrireListeDansFichier maliste "/home/gabriel/Documents/dicochangé.txt"
- ///////////////////////////////////////////////
- (*recupere la definition (exemple : "aa:bb:cc:dd"-> cc)*)
- let recupdef stringg =
- let tmp = string_to_char_list stringg in
- let rec gg tmp compteur = match tmp with
- []-> failwith"nul"
- |a::r when r=[] -> failwith "erreur de construction"
- |a::r-> if a=':' && compteur=1 then r else if a=':' && (compteur <>1) then gg r (compteur+1) else gg r compteur
- in gg tmp 0;;
- let totaldef stringg = recup_anglais( recupdef stringg);;
- //////////////////////////////////////////////////
- (*recupere le synonime(exemple : "aa:bb:cc:dd"-> dd)*)
- let recupsyno stringg =
- let tmp = string_to_char_list stringg in
- let rec gg tmp compteur = match tmp with
- []-> failwith"nul"
- |a::r when r=[] -> failwith "erreur de construction"
- |a::r-> if a=':' && compteur=2 then r else if a=':' && (compteur <>2) then gg r (compteur+1) else gg r compteur
- in gg tmp 0;;
- let totalsyno stringg= recup_anglais (recupsyno stringg);;
- /////////////////////////////////////////////////////
- (*recupere la definition (exemple : "aa:bb:cc:dd"-> bb)*)
- let recupfrancais stringg =
- let tmp = string_to_char_list stringg in
- let rec gg tmp compteur = match tmp with
- []-> failwith"nul"
- |a::r when r=[] -> failwith "erreur de construction"
- |a::r-> if a=':' && compteur=0 then r else if a=':' && (compteur <>0) then gg r (compteur+1) else gg r compteur
- in gg tmp 0;;
- let totalfrancais stringg = recup_anglais(recupfrancais stringg);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement