// uses ai_placeholderToList static S simplifyMatchJob1(MatchJob mj) { if (empty(mj.input) || empty(mj.struct)) ret "Solved"; if (eqic(first(mj.input), first(mj.struct))) { matchJob_apply(f dropFirst, mj); ret "Simplified"; } if (eqic(last(mj.input), last(mj.struct))) { matchJob_apply(f dropLast, mj); ret "Simplified"; } // Full match with category if (l(mj.struct) == 1 && isAngleBracketed(first(mj.struct))) { S placeholder = deAngleBracket(first(mj.struct)); S list = ai_placeholderToList().get(placeholder); if (list != null) { bool contained = mechList_containsTokens(list, mj.input); if (contained) { mj.vars.put(placeholder, joinWithSpace(mj.input)); mj.clear(); ret "Simplified"; } } } // Match leading category with first word if (isAngleBracketed(first(mj.struct))) { S placeholder = deAngleBracket(first(mj.struct)); S list = ai_placeholderToList().get(placeholder); if (list != null) { bool contained = mechList_containsTokens(list, ll(first(mj.input))); if (contained) { mj.vars.put(placeholder, first(mj.input)); matchJob_apply(f dropFirst, mj); ret "Simplified"; } } } ret "Nothing to do"; }
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: | #1014066 |
Snippet name: | simplifyMatchJob1 |
Eternal ID of this version: | #1014066/1 |
Text MD5: | d63c424f5d9c53bdce4887747828bb50 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-03-27 22:19:19 |
Source code size: | 1314 bytes / 42 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 305 / 346 |
Referenced in: | [show references] |