Changeset 740 for Deliverables/D2.2/8051/src/utilities
- Timestamp:
- Apr 4, 2011, 5:18:15 PM (10 years ago)
- Location:
- Deliverables/D2.2/8051/src/utilities
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
Deliverables/D2.2/8051/src/utilities/interference.mli
r486 r740 44 44 the key to be present in the map -- it will fail otherwise. *) 45 45 46 module Map : M ap.S with type key = t46 module Map : MyMap.S with type key = t 47 47 48 48 end -
Deliverables/D2.2/8051/src/utilities/miscPottier.ml
r619 r740 1 2 let rec max_list = function 3 | [] -> raise (Invalid_argument "MiscPottier.max_list") 4 | [a] -> a 5 | a :: l -> max a (max_list l) 6 7 let pow a b = 8 if b < 0 then raise (Invalid_argument "MiscPottier.pow2") 9 else 10 let rec aux = function 11 | 0 -> 1 12 | i -> a * aux (i-1) in 13 aux b 1 14 2 15 let rec make a n = … … 11 24 aux 0 12 25 13 let foldi f a = 26 let rec remove_n_first n = 27 let rec aux i = function 28 | [] -> [] 29 | l when i = n -> l 30 | _ :: l -> aux (i+1) l in 31 aux 0 32 33 let foldi_from_until n m f a l = 14 34 let rec aux i res = function 15 35 | [] -> res 16 | e :: l -> aux (i+1) (f i res e) l 17 in 18 aux 0 a 36 | _ when i >= m -> res 37 | e :: l -> aux (i+1) (f i res e) l in 38 aux 0 a (remove_n_first n l) 39 40 let foldi_from n f a l = foldi_from_until n (List.length l) f a l 41 42 let foldi_until m f a l = foldi_from_until 0 m f a l 43 44 let foldi f a l = foldi_from_until 0 (List.length l) f a l 19 45 20 46 let iteri f l = -
Deliverables/D2.2/8051/src/utilities/miscPottier.mli
r619 r740 1 1 2 (** This module provides some additional functions on lists. *) 2 (** This module provides some additional functions on lists or arithmetics. *) 3 4 val max_list : 'a list -> 'a 5 6 val pow : int -> int -> int 3 7 4 8 val make: 'a -> int -> 'a list 5 9 6 10 val index_of : 'a -> 'a list -> int 11 12 val foldi_until : int -> (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a 7 13 8 14 val foldi : (int -> 'a -> 'b -> 'a) -> 'a -> 'b list -> 'a
Note: See TracChangeset
for help on using the changeset viewer.