static bool matchCondition_random(Lisp condition, Map<S, Lisp> m) {
L<Lisp> facts = lispTruth();
O evaluator = getLispEvaluator(condition.head);
if (evaluator != null)
ret isTrue(callF(evaluator, lispReplaceVars(condition, m)));
L<Map<S, Lisp>> candidates = new L;
for (Lisp fact : facts) {
Map<S, Lisp> m2 = cloneMap(m);
if (lispMatchIC_xyzVars_sub(condition, fact, m2))
candidates.add(m2);
}
//print("Have " + n(candidates, "candidate"));
if (empty(candidates)) false;
m.putAll(random(candidates));
true;
}
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008125 |
| Snippet name: | matchCondition_random |
| Eternal ID of this version: | #1008125/1 |
| Text MD5: | 10bb2e5fb4a48d33e1e88dfd049c892f |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-04-25 15:54:28 |
| Source code size: | 571 bytes / 18 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 1105 / 1027 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1008129 - matchCondition_all |