Libraryless. Click here for Pure Java version (7333L/49K/162K).
1 | !7 |
2 | |
3 | concept TheList { |
4 | new L<S> entries; |
5 | } |
6 | |
7 | p { |
8 | db(); |
9 | if (isMainProgram()) botSleep(); |
10 | } |
11 | |
12 | synchronized answer { |
13 | if "* zur liste hinzufügen" { |
14 | theList().entries.add($1); |
15 | theList().change(); |
16 | ret "OK, hat Position " + l(theList().entries); |
17 | } |
18 | |
19 | if "* an position * zur liste hinzufügen" { |
20 | int i = parseInt($2)-1; |
21 | theList().entries.add(i, $1); |
22 | theList().change(); |
23 | ret "OK"; |
24 | } |
25 | |
26 | if "* aus der liste nehmen" { |
27 | int i = theList().entries.indexOf($1); |
28 | if (i < 0) ret "Nicht in Liste"; |
29 | else { |
30 | theList().entries.remove(i); |
31 | theList().change(); |
32 | } |
33 | ret "OK, entfernt aus Position " + (i+1); |
34 | } |
35 | |
36 | if "länge der liste" |
37 | ret lstr(theList().entries); |
38 | |
39 | if "eintrag * der liste" { |
40 | S entry = get(theList().entries, parseInt($1)-1); |
41 | ret entry == null ? "Nix" : "Eintrag: " + quote(entry); |
42 | } |
43 | } |
44 | |
45 | static TheList theList() { |
46 | ret uniq(TheList); |
47 | } |
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: | #1009225 |
Snippet name: | Listen-Kernbot [dev.] |
Eternal ID of this version: | #1009225/6 |
Text MD5: | 78913255da647973873f7452f27dc74f |
Transpilation MD5: | ba01acd4ad53991ecfd6e3a956a8bb98 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-07-19 03:08:11 |
Source code size: | 968 bytes / 47 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 489 / 619 |
Version history: | 5 change(s) |
Referenced in: | [show references] |