Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

33
LINES

< > BotCompany Repo | #1005116 // Calc One [dev]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

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;
}

Author comment

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: 500 / 556
Referenced in: [show references]