static Map<S, O> simplifyWordTree(Map<S, O> tree) { if (tree == null) null; ret (Map) simplifyWordTree_impl(tree, true); } static O simplifyWordTree_impl(O tree, bool keepAsMap) { if (tree instanceof S) ret tree; Map<S, O> m = cast tree; if (!keepAsMap && l(m) == 1 && eq(firstKey(m), "<default>")) ret (S) firstValue(m); Map<S, O> map = similarEmptyMap(m); for (S key, O value : m) { map.put(key, simplifyWordTree_impl(value, false)); } ret map; }
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: | 444 / 499 |
Version history: | 5 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |