def BBANS_append(posterior_pop, likelihood_append, prior_append):
    """
    Given functions to pop a posterior, append a likelihood and append the prior,
    return a function to append some data.
    """

    def append(ans, data):
        latent = posterior_pop(data)(ans)
        likelihood_append(latent)(ans, data)
        prior_append(ans, latent)

    return append