svoid applyRule_all_random(S ruleID) { // process the rule Lisp rule = getLispTruth(ruleID); if (rule == null) { print("Rule not found: " + ruleID); ret; } //print("Applying rule " + ruleID); print_setPrefixForThread(ruleID + "> "); try { L conditions = dropLast(rule.args); Lisp out = last(rule.args); L> results = matchConditions_all(conditions, new HashMap); print("Got " + n(results, "results")); if (empty(results)) ret; Map matches = random(results); print("Yo! " + struct(matches)); out = lispReplaceVars(out, matches); print("Possibly defining: " + lispToEnglish_prettier(out)); emit(out, ruleID); } finally { print_setPrefixForThread(""); } }