Discrete gradients for computational Bayesian inference