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

41
LINES

< > BotCompany Repo | #1028755 // Compare Scenarios [OK]

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

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

cprint {
  S scenario1 = autoUnindent_mls([[
    There is a plan
    The plan works
  ]]);

  S scenario2 = autoUnindent_mls([[
    There is this idea
    This idea is a plan
    This idea works
  ]]);

  NLABlock nla1, nla2;
  S output;
  
  visual jvsplit(
    jhsplit(
      hgridWithSpacing(
        jCenteredSection("Scenario 1 (in Natural Language Assembly)", dm_textAreaAsSection scenario1()),
        jCenteredSection("Scenario 2 (in Natural Language Assembly)", dm_textAreaAsSection scenario2())),
      dm_textAreaAsSection output()),
    super);
  
  start {
    dm_onFieldChange scenario1(r calc);
    dm_onFieldChangeAndNow scenario2(r calc);
  }

  void calc {
    setField(nla1 := nla_simplifyIntroductions(scenario1));
    setField(nla2 := nla_simplifyIntroductions(scenario2));
    printWithIndent("nla1: ", nla1);
    printWithIndent("nla2: ", nla2);
    
    L<Map<NLABlock.Entity>> mappings = nla_partialMappings(nla1, nla2);
    if (empty(mappings))
      setField(output := "Scenarios incompatible");
    else
      setField(output := "Scenarios compatible:\n\n" + lines(mappings));
  }
}

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: #1028755
Snippet name: Compare Scenarios [OK]
Eternal ID of this version: #1028755/10
Text MD5: 1236b7ecb756cc27709509267e9ee755
Transpilation MD5: 6389f795eba5295d537e379c405c8281
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-07-07 01:33:38
Source code size: 1150 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 195 / 548
Version history: 9 change(s)
Referenced in: