Bonjour,
voila je débute en Ocaml, et je suis censé écrire un pgm qui parse un fichier, ma fonction cut sépare tout les éléments d'une ligne (symboles , espaces , ..) un par un,
exemple: si je rencontre la ligne : foo (x,y) ma fonction cut devrait afficher
foo
(
x
,
y
)
mais voila, pour le faire j'ai écrit ma fonction cut au début du fichier (Toplevel) et je l'appel en local lors du dernier pipe:
comme ce qui suit:
et la je suis censé appeler ma fonction!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 let cut line = match Str.split (Str.regexp "\t") line with _::rest -> List.iter out (rest) | _ -> ( match ( Str.split (Str.regexp "=") line) with _::rest -> List.iter out (rest) | _ -> .......... ............ blah blah blah la j'ai un piepe | _ -> let lines = if String.get line 0 != '+' then blah blah bla
mais je ne sais pas comment faire parce que j'ai une syntax ERROR!!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 let f = cut line (* in lines *) in () | _ -> ()
Partager