Libraryless. Click here for Pure Java version (1457L/10K/33K).
1 | !7 |
2 | |
3 | sS input_train = [[ |
4 | Suppose we have a list. The list has 5 elements. How many elements does the list have? 5 |
5 | ]]; |
6 | |
7 | sS input_test = [[ |
8 | Suppose we have a list. The list has 3 elements. How many elements does the list have? |
9 | ]]; |
10 | |
11 | p { |
12 | L<S> tok_train = parse(input_train); |
13 | L<S> tok_test = parse(input_test); |
14 | printStruct(simpleComplete(tok_train, tok_test)); |
15 | } |
16 | |
17 | static L<S> simpleComplete(L<S> tok_train, L<S> tok_test) { |
18 | assertTrue("Bad length", l(tok_train) >= l(tok_test)); |
19 | new SS map; |
20 | for (int i = 1; i < l(tok_test); i += 2) |
21 | map.put(tok_train.get(i), tok_test.get(i)); |
22 | new L<S> out; |
23 | for (int i = l(tok_test); i < l(tok_train); i += 2) { |
24 | S t = tok_train.get(i); |
25 | out.add(getOrKeep(map, t)); |
26 | } |
27 | ret out; |
28 | } |
29 | |
30 | static L<S> parse(S s) { ret simpleSpaces(javaTok(s)); } |
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: | #1008465 |
Snippet name: | List Logic [OK] |
Eternal ID of this version: | #1008465/5 |
Text MD5: | 817396408364d772009314095617fac5 |
Transpilation MD5: | 69d0e86c220f4e895effa2c48f1360de |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-05-16 14:46:32 |
Source code size: | 827 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 428 / 548 |
Version history: | 4 change(s) |
Referenced in: | [show references] |