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 )
type etat={
id: int;
conditions_darrive: (char array) option;
mutable voisins: (etat array) option;
terminal:bool;
}
exception Reconnu
let reconnaitre automate str=
let rec reconrec a s k=
if String.length s = k && a.terminal then
raise Reconnu
else
match a.voisins with
None -> ()
| 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 ->
if k>= String.length s then
()
else
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)
done
done
in
try
reconrec automate str 0;
false
with
Reconnu -> true
Revise this Paste
Parent: 45948