Ignore:
Timestamp:
Dec 2, 2011, 3:13:04 PM (8 years ago)
Author:
tranquil
Message:
  • new form of translation written in graphUtilites (mainly as a test before implementation in Matita)
  • rewritten multiplication in RTLasbToRTL
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Deliverables/D2.2/8051/src/utilities/miscPottier.ml

    r818 r1584  
    11
    2 let rec map3 f al bl cl =
     2let map3 f al bl cl =
    33  let f' ((a, b), c) = f a b c in
    44  List.map f' (List.combine (List.combine al bl) cl)
     5
     6let fold3_right f al bl cl =
     7  let f' ((a, b), c) d = f a b c d in
     8  List.fold_right f' (List.combine (List.combine al bl) cl)
    59
    610let rec max_list = function
     
    2529
    2630let rec make a n =
    27   if n = 0 then []
     31  if n <= 0 then []
    2832  else a :: (make a (n-1))
     33
     34let makei f n =
     35  let rec app f k =
     36  if k >= n then []
     37  else f k :: (app f (k + 1)) in
     38  app f 0
    2939
    3040let index_of x =
     
    159169  in
    160170  aux
     171
     172
     173let rec sublist l k h =
     174  if h < k || h < 0 || k < 0 then
     175    invalid_arg "sublist: invalid interval"
     176  else
     177  match k, h, l with
     178  | 0, 0, _ -> []
     179  | 0, _, x :: l -> x :: sublist l 0 (h-1)
     180  | _, _, x :: l -> sublist l (k-1) (h-1)
     181  | _ -> invalid_arg "sublist: invalid interval"
     182
     183let rec fill l n =
     184  let k = List.length l in
     185  if k = 0 then invalid_arg "fill: list empty" else
     186  if n < 0 then invalid_arg "fill: negative argument" else
     187  if n <= k then sublist l 0 n else
     188    l @ fill l (n - k)
Note: See TracChangeset for help on using the changeset viewer.