-let rec list_nth n = function
- | [] -> raise_error ET.ENoEntry
- | (_,hd)::tl -> if n = 0 then hd else list_nth (pred n) tl
-
-let rec list_toggle n = function
- | [] -> raise_error ET.ENoEntry
- | (b,hd)::tl -> if n = 0 then (not b,hd)::tl else (b,hd)::list_toggle (pred n) tl
-
-let rec list_toggle_all = function
- | [] -> []
- | (b,hd)::tl -> (not b,hd)::list_toggle_all tl
-
-let rec list_split = function
- | [] -> [], []
- | (b,a) as hd :: tl ->
- let fs,ts = list_split tl in
- if fst hd then fs,((false,a)::ts)
- else (hd::fs),ts
-
-let rec list_select r = function
- | [] -> r
- | (b,hd)::tl ->
- begin match b, r with
- | false, _ -> list_select r tl
- | true , None -> list_select (Some hd) tl
- | true , Some _ -> raise_error (ET.EWrongSelect)
- end
+let rec list_apply prop map n = function
+ | [] -> false
+ | hd :: tl ->
+ if prop n hd then begin map hd; true end
+ else list_apply prop map (succ n) tl
+
+let list_nth map n l =
+ let prop m _ = m = n in
+ if list_apply prop map 0 l then () else raise_error ET.ENoEntry