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

16
LINES

< > BotCompany Repo | #1014224 // simplifyWordTree

JavaX fragment (include)

1  
static Map<S, O> simplifyWordTree(Map<S, O> tree) {
2  
  if (tree == null) null;
3  
  ret (Map) simplifyWordTree_impl(tree, true);
4  
}
5  
6  
static O simplifyWordTree_impl(O tree, bool keepAsMap) {
7  
  if (tree instanceof S) ret tree;
8  
  Map<S, O> m = cast tree;
9  
  if (!keepAsMap && l(m) == 1 && eq(firstKey(m), "<default>"))
10  
    ret (S) firstValue(m);
11  
  Map<S, O> map = similarEmptyMap(m);
12  
  for (S key, O value : m) {
13  
    map.put(key, simplifyWordTree_impl(value, false));
14  
  }
15  
  ret map;
16  
}

Author comment

Began life as a copy of #1014222

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1014224
Snippet name: simplifyWordTree
Eternal ID of this version: #1014224/6
Text MD5: 8df7320b1bdbeba09bfe5514ee70a7df
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-16 03:21:25
Source code size: 490 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 443 / 498
Version history: 5 change(s)
Referenced in: [show references]