Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. let rec ecrireListeDansChannel l c = match l with
  2. [] -> ()
  3. | x::r -> output_string c (x^"\n"); ecrireListeDansChannel r c;;
  4.  
  5. let ecrireListeDansFichier l file =
  6. let channel = open_out file in
  7. ecrireListeDansChannel l channel;
  8. close_out channel;;
  9.  
  10. ecrireListeDansFichier maliste "/home/gabriel/Documents/dicochangé.txt"
  11.  
  12. ///////////////////////////////////////////////
  13. (*recupere la definition (exemple : "aa:bb:cc:dd"-> cc)*)
  14. let recupdef stringg =
  15. let tmp = string_to_char_list stringg in
  16. let rec gg tmp compteur = match tmp with
  17. []-> failwith"nul"
  18. |a::r when r=[] -> failwith "erreur de construction"
  19. |a::r-> if a=':' && compteur=1 then r else if a=':' && (compteur <>1) then gg r (compteur+1) else gg r compteur
  20. in gg tmp 0;;
  21.  
  22. let totaldef stringg = recup_anglais( recupdef stringg);;
  23.  
  24. //////////////////////////////////////////////////
  25. (*recupere le synonime(exemple : "aa:bb:cc:dd"-> dd)*)
  26. let recupsyno stringg =
  27. let tmp = string_to_char_list stringg in
  28. let rec gg tmp compteur = match tmp with
  29. []-> failwith"nul"
  30. |a::r when r=[] -> failwith "erreur de construction"
  31. |a::r-> if a=':' && compteur=2 then r else if a=':' && (compteur <>2) then gg r (compteur+1) else gg r compteur
  32. in gg tmp 0;;
  33.  
  34.  
  35. let totalsyno stringg= recup_anglais (recupsyno stringg);;
  36.  
  37. /////////////////////////////////////////////////////
  38. (*recupere la definition (exemple : "aa:bb:cc:dd"-> bb)*)
  39. let recupfrancais stringg =
  40. let tmp = string_to_char_list stringg in
  41. let rec gg tmp compteur = match tmp with
  42. []-> failwith"nul"
  43. |a::r when r=[] -> failwith "erreur de construction"
  44. |a::r-> if a=':' && compteur=0 then r else if a=':' && (compteur <>0) then gg r (compteur+1) else gg r compteur
  45. in gg tmp 0;;
  46.  
  47.  
  48. let totalfrancais stringg = recup_anglais(recupfrancais stringg);;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement