Libraryless. Click here for Pure Java version (4057L/26K/86K).
!759 // deterministic even static boolean safe(Native n) { if (n.match("[X] = snlTok(in S Y)")) yo { n.set("X", listToSNLTree(codeTokensOnly(snlTok(n.str())))); ret true; } if (n.match("the < opsplit < of < in X < is < Y")) yo { n.set("Y", snlSplitOps(n.get())); ret true; } if (n.match("true")) yo { ret true; } if (n.match("X = X")) yo { ret true; } if (n.match("isLeaf(in X)")) yo { ret n.get().isEmpty(); } if (n.match("X = head(in Y)")) yo { n.set("X", n.get().head); ret true; } if (n.match("X = args(in Y)")) yo { n.set("X", listToSNLTree(n.get().args)); ret true; } if (n.match("X = lisp(in Y)")) yo { L<Lisp> l = snlParseList(n.get()); //print("List found: " + structure(l)); if (l.isEmpty()) ret false; S head = unquote(l.get(0).raw()); L<Lisp> args = dropFirst(l); //print("Args: " + structure(args)); Lisp result = lisp(head, args); //print("Result: " + structure(result)); n.set("X", result); ret true; } ret false; }
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: | #1002765 |
Snippet name: | SNL Native: opsplit, snlTok, true, isLeaf etc. |
Eternal ID of this version: | #1002765/1 |
Text MD5: | d130baf758f38d9ce4439d7a3d948108 |
Transpilation MD5: | a7e96a468346839358ad922fa7cef989 |
Author: | stefan |
Category: | eleu / nl |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-02-26 04:39:19 |
Source code size: | 1123 bytes / 51 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 832 / 1355 |
Referenced in: | [show references] |