let mkindex fold filter =
fold begin fun name contents acc ->
if filter name then
List.fold_right begin fun elt acc ->
add elt (name :: (find_all_list elt acc)) acc
end contents acc
else
acc
end empty