sS ai_expandPatternForAAndAn(S s) { LS tok = javaTok(s); if (!cicOneOf(tok, "a", "an") || contains(tok, "|")) null; // TODO: allow | L<Int> indices = indicesOfAnyIC(tok, "a", "an"); int n = l(indices); if (n == 0) null; new L<S> out; for (L<S> l : allCombinations(rep(n, ll("a", "an")))) { for i over l: tok.set(indices.get(i), l.get(i)); out.add(join(tok)); } ret join("|", out); }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1017911 |
| Snippet name: | ai_expandPatternForAAndAn |
| Eternal ID of this version: | #1017911/5 |
| Text MD5: | a577a8d7a43f0d5d1277299a2ecd2d0a |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-08-22 23:06:13 |
| Source code size: | 427 bytes / 14 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 661 / 709 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |