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

44
LINES

< > BotCompany Repo | #1027746 // New Engine Spike [backup with shallowZip]

JavaX source code (Dynamic Module) - run with: Stefan's OS

!include once #1027630 // Msg

cmodule NewEngineSpike > DynPrintLog {
  L<Msg> msgs;
  
  start-thread {
    if (empty(msgs))
      setField(msgs := mainCruddieLog());
    print("Have " + nMessages(msgs));
    pnlStruct(takeFirst(2, msgs));
    L<Msg> msgs2 = whereFieldIsTrue fromUser(msgs);
    new L props;
    for (Msg msg : takeFirst(5, msgs2))
      print(addAndReturn(props, ll(msg, "was understood correctly")));
    props.add(print(ll(get(msgs2, 5),"is a wrong recognition")));
    O pat = ll("$x", "was Understood correctly");
    for (O prop : props) {
      print(prop);
      print("  => " + mapToStringWithSize(deepZip(pat, prop)));
    }
  }

  Map shallowZip(O inputA, O inputB) {
    if (eqOrEqic_gen(inputA, inputB)) ret emptyMap();
    if (inputA instanceof L && inputB instanceof L)
      ret antiFilterMap eqOrEqic_gen(zipTwoListsToMap_strict(inputA/L, inputB/L));
    null;
  }

  Map deepZip(O inputA, O inputB) {
    Map map = shallowZip(inputA, inputB);
    if (map == null) null;
    Map map2 = similarEmptyMap(map);
    for (O a, b : map) {
      if (a instanceof L && b instanceof L) {
        Map subMap = deepZip(a, b);
        if (subMap == null) null;
        if (!putAllStrictly(map2, subMap)) null;
      } else
        if (!strictPut(map2, a, b)) null;
    }
    ret map2;
  }
}

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: #1027746
Snippet name: New Engine Spike [backup with shallowZip]
Eternal ID of this version: #1027746/1
Text MD5: 84c38dc4e32760ecfa9ca71f2ad3a961
Author: stefan
Category:
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-04-09 23:17:59
Source code size: 1313 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 167 / 188
Referenced in: [show references]