let fold_from_func f acc kf =
    let ac = ref acc in
    let fold ki = ignore (ac := f (!ac) ki)
    in iter_from_func fold kf ; !ac