Advanced Functional Prog.
back - up - cont
Parsing expressions
Answer
let dig s =
match s with
| "" -> []
| _ -> if ('0'<=s.[0])&(s.[0]<='9') then [(s.[0],s.[1..])] else [];;
dig "12";;
rep dig "12";;
Alternativly, by mastering functional/lists' functions:
let dig2 = List.map sym ['0'..'9'] |> List.reduce (||);;
dig2 "12";;
let num2 = rep dig2;;
num2 "12";;
7 - 18
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp
advanced functional programming programmation fonctionnelle avancée dr mulhouse ensisa france thiry laurent uha fun fsharp