let acc2 acc f a1 a2 =
  let (b, side_effect) = f a1 a2 in
    acc := side_effect :: !acc; b