sclass NewWoody { Map rulesByName; S lastOutput; *() { rulesByName = indexFieldAsCIMap('listName, bb_allRules()); } *(NewWoody w) { rulesByName = w.rulesByName; } void processInput(S s) { temp tempSetTL(ctxContext_var(), nu(CtxContext, +input)); new L matching; for (BBRule r : values(rulesByName)) { continue if empty(r.expression); if (ctxEvalCondition(r.expression)) matching.add(r); } lastOutput = null; activeRule = first(matching); if (activeRule != null) lastOutput = random(activeRule.answers); } }