Programming With Models: Writing Statistical Algorithms for General Model Structures With NIMBLE