From 85e9aca244eb47dd129ec6def18c3266f26a965d Mon Sep 17 00:00:00 2001 From: Atiyah Date: Fri, 2 Dec 2022 10:29:42 +0000 Subject: [PATCH] Utilities: apply Transition is part of mainHelpers.jl and not SE libraries --- mainHelpers.jl | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mainHelpers.jl b/mainHelpers.jl index 2a8c0e8..2ed5549 100644 --- a/mainHelpers.jl +++ b/mainHelpers.jl @@ -52,6 +52,20 @@ function initializeDemography!(model, poppars, workpars, mappars) nothing end +"Apply a transition function to an iterator." +function applyTransition!(people, transition, name, args...) + count = 0 + for p in people + transition(p, args...) + count += 1 + end + + verbose() do + if name != "" + println(count, " agents processed in ", name) + end + end +end # Atiyah: remove this for the primative API simulation function # alivePeople(model) = Iterators.filter(a->alive(a), model.pop)