static L<Exp> nlLogic_unrollAndApplyRuleWithParams(RuleWithParams r) {
  new L<Exp> out;
  for (Exp e : nlLogic_unrollAnd(r.rule.out)) {
    e = nlLogic_applyMatches(e, r.matches);
    if (!nlLogic_checkHelper(e, r.matches)) // changes matches e.g. for newID()
      out.add(e);
  }
  ret out;
}