static S nlUnparse(Lisp tree) { ret nlUnparse(tree, true); } static S nlUnparse(Lisp tree, boolean dropOuterBrackets) { new StringBuilder buf; nlUnparse(tree, buf, dropOuterBrackets); ret str(buf); } static void nlUnparse(Lisp tree, StringBuilder buf, boolean dropOuterBrackets) { if (tree == null) ret; // special classes - Var etc. if (tree.getClass() != Lisp.class) { buf.append(tree); ret; } if (tree.isA("[]")) { if (!dropOuterBrackets) buf.append("["); } else if (tree.isA("()")) buf.append("("); else { if (tree.isLeaf()) buf.append(tree.head); else buf.append("?? " + tree); ret; } for (int i = 0; i < tree.size(); i++) { if (i != 0) buf.append(" "); nlUnparse(tree.get(i), buf, false); } if(tree.isA("[]")) { if (!dropOuterBrackets) buf.append("]"); } else buf.append(")"); }
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: | #1002840 |
Snippet name: | nlUnparse |
Eternal ID of this version: | #1002840/1 |
Text MD5: | fd2c2ee3d181aa6d9a8605ce3ab25e10 |
Author: | stefan |
Category: | eleu / nl |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-03-10 01:08:35 |
Source code size: | 926 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 667 / 834 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #3000382 - Answer for ferdie (>> t = 1, f = 0) |