Welcome, guest! Login / Register - Why register?
Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!

Paste

Pasted as OCaml by lorilan ( 13 years ago )
exception Reconnu

let reconnaitre automate str=

  let rec reconrec a s k=
    if String.length s = k then
      (if a.terminal then
 raise Reconnu
      else
 false)
    else
      match a.voisins with
   None -> false
 | Some vss ->
     for i=0 to (Array.length vss)-1 do
       let v=Array.get vss i in
  match v.conditions_darrive with
      None -> reconrec v s k
    | Some cdts ->
        for j=0 to (Array.length cdts)-1 do 
   if ( Char.compare s.[k] (Array.get cdts j) )=0 then
     reconrec v s (k+1)
   else
     false
        done
     done
  in
    try 
      reconrec automate str 0
    with
 Reconnu -> true

 

Revise this Paste

Children: 45948
Your Name: Code Language: