Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
OCaml 0.35 KB | None | 0 0
  1. type arbre =  Noeud of bool ref  * (char * arbre) list ref
  2.  
  3. (* l is a list of string. creer_branche takes a list of char and returns a Noeud *)
  4.  
  5. let creer l =
  6.     let rec make_tree l acc = match l, acc with
  7.     | [], acc' -> acc'
  8.     | word :: l', (a, b) -> make_tree (l' Noeud(a, ref (creer_branche (explode word))::!b))
  9.     in make_tree (l vide)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement