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

33
LINES

< > BotCompany Repo | #1020766 // British To American

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

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

!7

concept Translation {
  S british, american;
}

compact module BritishToAmerican > DynCRUD<Translation> {
  S output;
  
  *() { super(Translation); }
  
  start {
    dm_onTopInput(voidfunc(S s) {
      setField(output := nullIfEq(s, translate(s)));
      dm_findAndCallModule("#1020768/TransformedInput", 'addEntry, s, output, programID());
    });
  }
  
  visualize {
    ret centerAndSouth(super.visualize(),
      withMargin(withLabel("Output:", dm_boldFieldLabel('output))));
  }
  
  // API
  
  SS getTranslationMap() {
    ret main.<S> mapFromKeyAndValueField(list(Translation), 'british, 'american);
  }
  
  S translate(S s) {
    ret replaceCodeTokensUsingMap(getTranslationMap(), s);
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020766
Snippet name: British To American
Eternal ID of this version: #1020766/7
Text MD5: 4579330aad1ea48e8a6e780f2003f01d
Transpilation MD5: 2704410c527b587dd362037f293cf0d4
Author: stefan
Category: javax / stefan's os
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-02 00:47:55
Source code size: 739 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 220 / 567
Version history: 6 change(s)
Referenced in: [show references]