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

26
LINES

< > BotCompany Repo | #1026505 // ELE: Match current to past Input word-by-word [dev.]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (3615L/19K).

!7

sclass Entry {
  S time, text;
  SS mapping;
  S wordsChanged;
}

cmodule ELEMatchWithPastInput > DynObjectTable<Entry> {
  start { doEvery(1.0, r grab); }
  
  void grab enter {
    if (!ele_on()) ret;
    S input = ele_currentInput();
    if (empty(input)) ret with clear();
    
    int wordCount = countCodeTokens(javaTokWithBrackets_cached(input));
    Cl<virtual Entry> l = ele_pastInputs();
    setData(sortedByField_alphaNum wordsChanged(mapNonNulls(l, e -> {
      SS mapping = gazelle_zip(getString text(e), input);
      if (mapping == null) null;
      ret setAll(quickImportToClass Entry(e), +mapping,
        wordsChanged := l(mapping) + "/" + wordCount);
    })));
  }
}

Author comment

Began life as a copy of #1026353

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026505
Snippet name: ELE: Match current to past Input word-by-word [dev.]
Eternal ID of this version: #1026505/5
Text MD5: 06564d4cc97b7fbac2cdb021c464b150
Transpilation MD5: 872060e693335a919d156475cf09b115
Author: stefan
Category: javax / electric logic engine
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-07 17:00:03
Source code size: 714 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 125 / 276
Version history: 4 change(s)
Referenced in: [show references]