1 | // if match: returns -1 |
2 | // if no match: returns how many conditions were met |
3 | static int matchConditions_random(L<Lisp> conditions, Map<S, Lisp> m) { |
4 | if (empty(conditions)) ret -1; |
5 | Lisp condition = first(conditions); |
6 | Map<S, Lisp> m2 = cloneMap(m); |
7 | if (!matchCondition_random(condition, m2)) { |
8 | print("Condition failed: " + condition); |
9 | ret 0; |
10 | } |
11 | print("Condition matched, " + struct(m2)); |
12 | int n = matchConditions_random(dropFirst(conditions), m2); |
13 | if (n == -1) { |
14 | m.putAll(m2); |
15 | ret -1; |
16 | } |
17 | ret n+1; // failure |
18 | } |
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: | #1008124 |
Snippet name: | matchConditions_random |
Eternal ID of this version: | #1008124/1 |
Text MD5: | ad80a502205884c848d6a193e073e6c4 |
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 14:17:18 |
Source code size: | 559 bytes / 18 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 468 / 501 |
Referenced in: | [show references] |