Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.51 KB | None | 0 0
  1. type arbre =  Noeud of bool ref  * (char * arbre) list ref
  2.  
  3. (*Not necessary but left here in case *)
  4. let rec creer_branche cs = match cs with
  5.   | [] -> vide ()
  6.   | [c] -> Noeud (ref false, ref [c, Noeud(ref true, ref [])])
  7.   | c :: cs' -> Noeud (ref false, ref [c, creer_branche cs'])
  8.  
  9. let ajouter arbre mot =
  10.     let get_tuple_list (Noeud(a, b)) = b in
  11.     let add arbre mot = match arbre, mot with
  12.     | Noeud(a, b), mot' -> (!(get_tuple_list (creer_branche (explode mot))) @ !b; ())
  13.   in add arbre mot
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement