Libraryless. Click here for Pure Java version (1421L/11K/36K).
!752 p { typeWriterConsole(); L<S> paragraphs = superState(); printNumberedParagraphs(paragraphs); if (empty(paragraphs)) { print("Nothing to work with"); ret; } L<Para> paras = numberParagraphs(paragraphs); int redundancy = 0; for (Para p : paras) { S method = calcOne(paras, p); if (notNull(method)) { print(p.index + " = " + method); ++redundancy; } } print("Redundancy: " + redundancy + " / " + l(paras)); } // returns calculation method if pivot could be calculated from other paragraphs static S calcOne(L<Para> all, Para pivot) { L<Para> rest = listMinus(all, pivot); for (Para p : rest) { if (eq(p.text, pivot.text)) ret "copy(" + p.index + ")"; } null; }
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: | 551 / 623 |
Referenced in: | #1005153 - optimizeLastLine (dev.) |