6 invalid_arg "HList.last"
16 invalid_arg "HList.init"
33 invalid_arg "HList.fold_left1"
37 let rec fold_right1 f =
40 invalid_arg "HList.fold_right1"
44 f x (fold_right1 f xs)
47 List.fold_left (&&) true
50 List.fold_left (||) false
56 List.fold_left ( * ) 1
59 List.fold_right ((@) $ f) xs []
86 match scanr f z xs with
90 failwith "must not happen"
104 loop (i-1) (x::ys) in
126 let rec splitAt n xs =
135 let rec takeWhile f =
142 let rec dropWhile f =
161 let rec zip_with f xs ys =
166 (f x y)::zip_with f xs' ys'
168 let rec zip_with3 f xs ys zs =
170 [],_,_ | _,[],_ | _,_,[] ->
172 | x::xs',y::ys',z::zs' ->
173 (f x y z)::zip_with3 f xs' ys' zs'
176 zip_with (fun x y -> (x,y)) xs ys
179 zip_with3 (fun x y z -> (x,y,z)) xs ys zs
182 List.fold_right (fun (x,y) (xs,ys) -> (x::xs,y::ys)) xs ([],[])
185 List.fold_right (fun (x,y,z) (xs,ys,zs) -> (x::xs,y::ys,z::zs)) xs ([],[],[])
189 Some (List.assoc x xs)