]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/ocaml/tactics/tacticals.ml
merged changes from the svn fork by me and Enrico
[helm.git] / helm / ocaml / tactics / tacticals.ml
index 5ea64913d0debbeacac87bcd4673a060f134c88c..0479264d45d5a82b165f6cdbb896d5c56b4b5374 100644 (file)
@@ -47,7 +47,6 @@ let id_tac =
  in 
   mk_tactic tac
 
-
   (**
     naive implementation of ORELSE tactical, try a sequence of tactics in turn:
     if one fails pass to the next one and so on, eventually raises (failure "no
@@ -110,9 +109,11 @@ let then_ ~start ~continuation =
  in
   mk_tactic (then_ ~start ~continuation)
 
-(* Galla *)
-(* si suppone che tutte le tattiche sollevino solamente Fail? *)
-
+let rec seq ~tactics =
+  match tactics with
+  | [] -> assert false
+  | [tac] -> tac
+  | hd :: tl -> then_ ~start:hd ~continuation:(seq ~tactics:tl)
 
 (* TODO: x debug: i due tatticali seguenti non contano quante volte hanno applicato la tattica *)
 
@@ -187,6 +188,7 @@ let try_tactic ~tactic =
   mk_tactic (try_tactic ~tactic)
 ;;
 
+let fail = mk_tactic (fun _ -> raise (Fail "fail tactical"))
 
 (* This tries tactics until one of them doesn't _solve_ the goal *)
 (* TODO: si puo' unificare le 2(due) chiamate ricorsive? *)