Uses 5909K of libraries. Click here for Pure Java version (9477L/49K).
1 | !7 |
2 | |
3 | set flag AllowMetaCode. set flag Reparse. meta-transformNow { tok_standardBot } |
4 | |
5 | standard bot WeNeed { |
6 | Set<S> db = ciSet(); |
7 | |
8 | S add(S s) { if (db.add(s)) change(); null; } |
9 | S remove(S s) { ret db.remove(s) ? with(r change, "What a relief") : null; } |
10 | S listWithPattern(S pat) { ret or2(lines(map(db, x -> format(ellipsisToStar(pat), x))), "nothing"); } |
11 | S clearAfterConfirm() { ret "You're kidding, right?"; } |
12 | |
13 | sync S processSimplifiedLine(S s, O... _) { |
14 | try answer super.processSimplifiedLine(s, _); |
15 | new Matches m; |
16 | |
17 | meta { |
18 | S program = [[ |
19 | We need ... = + |
20 | We have ... = - |
21 | Someone gave us ...|Someone gave me ... = - |
22 | What do we need = listWithPattern("We need ...") |
23 | We don't need ... anymore = - |
24 | We need nothing|We don't need anything = clear after confirm |
25 | ]]; |
26 | ret ai_lineEquationsToMatchX2Statements(jreplace_multi(program, |
27 | "+", "add(\\$1);", |
28 | "-", "remove(\\$1);", |
29 | "clear after confirm", "clearAfterConfirm();")); |
30 | } |
31 | null; |
32 | } |
33 | } |
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1025387 |
Snippet name: | We Need [shortened] |
Eternal ID of this version: | #1025387/9 |
Text MD5: | ee1d4378f157593d5c7c0d15164ab07b |
Transpilation MD5: | 18eda4750450525542cf96ee751c84a4 |
Author: | stefan |
Category: | |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-09-27 17:13:32 |
Source code size: | 1086 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 654 / 789 |
Version history: | 8 change(s) |
Referenced in: | [show references] |