X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;ds=sidebyside;f=matita%2Fcomponents%2Fbinaries%2Fmatex%2Fground.ml;h=7eebedb7d13e8fa810c4dc0eb867aa038362e474;hb=50a9ed8c6207145fccf59e6a5dbbff935cd2c6d7;hp=c24162ae0e3e47c2cf950a312407d61929be4413;hpb=788e7cb15734fd228e8788ea628934af483ae772;p=helm.git diff --git a/matita/components/binaries/matex/ground.ml b/matita/components/binaries/matex/ground.ml index c24162ae0..7eebedb7d 100644 --- a/matita/components/binaries/matex/ground.ml +++ b/matita/components/binaries/matex/ground.ml @@ -19,6 +19,8 @@ exception Error of string let id x = x +let id2 x y = x, y + let rec segments_of_string ss l s = match try Some (S.index s '/') with Not_found -> None with | None -> s :: ss @@ -46,10 +48,21 @@ let rec foldi_left mapi i a = function | [] -> a | hd :: tl -> foldi_left mapi (succ i) (mapi i a hd) tl +let rec rev_mapi mapi i l = + let map i a hd = mapi i hd :: a in + foldi_left map i [] l + let rec rev_map_append map l r = match l with | [] -> r | hd :: tl -> rev_map_append map tl (map hd :: r) +let rec split_at x = function + | l when x <= 0 -> [], l + | [] -> [], [] + | hd :: tl -> + let l1, l2 = split_at (pred x) tl in + hd :: l1, l2 + let error s = raise (Error s) let log s = P.eprintf "MaTeX: %s\n%!" s