static S replaceOrDropCodeTokensUsingMap(S s, SS map) { ret join(replaceOrDropCodeTokensUsingMap(javaTok(s), map); } static LS replaceOrDropCodeTokensUsingMap(LS tok, SS map) { LS out = emptyList(tok); for i over tok: { if (odd(i)) out.add(tok.get(i)); else { S val = lookupOrKeep(map, tok.get(i)); if (nempty(val)) out.add(val); else { out.add(ai_mergeWhitespace(last(out), tok.get(i+1))); i++; } } } ret out; } sS replaceOrDropCodeTokensUsingMap(SS map, S s) { ret replaceOrDropCodeTokensUsingMap(s, map); }
Began life as a copy of #1014558
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1023231 |
Snippet name: | replaceOrDropCodeTokensUsingMap - drops token on empty value [dev.] |
Eternal ID of this version: | #1023231/3 |
Text MD5: | 081792eea64aba59023a3b81a2e4e2f3 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-05-18 13:42:38 |
Source code size: | 606 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 245 / 275 |
Version history: | 2 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |