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

1  
!include once #1027630 // Msg
2  
3  
cmodule NewEngineSpike > DynPrintLog {
4  
  L<Msg> msgs;
5  
  
6  
  start-thread {
7  
    if (empty(msgs))
8  
      setField(msgs := mainCruddieLog());
9  
    print("Have " + nMessages(msgs));
10  
    pnlStruct(takeFirst(2, msgs));
11  
    L<Msg> msgs2 = whereFieldIsTrue fromUser(msgs);
12  
    new L props;
13  
    for (Msg msg : takeFirst(5, msgs2))
14  
      print(addAndReturn(props, ll(msg, "was understood correctly")));
15  
    props.add(print(ll(get(msgs2, 5),"is a wrong recognition")));
16  
    O pat = ll("$x", "was Understood correctly");
17  
    for (O prop : props) {
18  
      print(prop);
19  
      print("  => " + mapToStringWithSize(deepZip(pat, prop)));
20  
    }
21  
  }
22  
23  
  Map shallowZip(O inputA, O inputB) {
24  
    if (eqOrEqic_gen(inputA, inputB)) ret emptyMap();
25  
    if (inputA instanceof L && inputB instanceof L)
26  
      ret antiFilterMap eqOrEqic_gen(zipTwoListsToMap_strict(inputA/L, inputB/L));
27  
    null;
28  
  }
29  
30  
  Map deepZip(O inputA, O inputB) {
31  
    Map map = shallowZip(inputA, inputB);
32  
    if (map == null) null;
33  
    Map map2 = similarEmptyMap(map);
34  
    for (O a, b : map) {
35  
      if (a instanceof L && b instanceof L) {
36  
        Map subMap = deepZip(a, b);
37  
        if (subMap == null) null;
38  
        if (!putAllStrictly(map2, subMap)) null;
39  
      } else
40  
        if (!strictPut(map2, a, b)) null;
41  
    }
42  
    ret map2;
43  
  }
44  
}

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