Libraryless. Click here for Pure Java version (1421L/11K/36K).
1 | !752 |
2 | |
3 | p { |
4 | typeWriterConsole(); |
5 | L<S> paragraphs = superState(); |
6 | printNumberedParagraphs(paragraphs); |
7 | if (empty(paragraphs)) { |
8 | print("Nothing to work with"); |
9 | ret; |
10 | } |
11 | L<Para> paras = numberParagraphs(paragraphs); |
12 | |
13 | int redundancy = 0; |
14 | for (Para p : paras) { |
15 | S method = calcOne(paras, p); |
16 | if (notNull(method)) { |
17 | print(p.index + " = " + method); |
18 | ++redundancy; |
19 | } |
20 | } |
21 | |
22 | print("Redundancy: " + redundancy + " / " + l(paras)); |
23 | } |
24 | |
25 | // returns calculation method if pivot could be calculated from other paragraphs |
26 | static S calcOne(L<Para> all, Para pivot) { |
27 | L<Para> rest = listMinus(all, pivot); |
28 | for (Para p : rest) { |
29 | if (eq(p.text, pivot.text)) |
30 | ret "copy(" + p.index + ")"; |
31 | } |
32 | null; |
33 | } |
Began life as a copy of #1005104
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005116 |
Snippet name: | Calc One [dev] |
Eternal ID of this version: | #1005116/1 |
Text MD5: | 84776e5776551a89bea8dc9e797ff044 |
Transpilation MD5: | 0d3e15547ab99397f37a95c82bc0520c |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-17 02:18:54 |
Source code size: | 779 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 552 / 624 |
Referenced in: | [show references] |