Libraryless. Click here for Pure Java version (4057L/26K/86K).
1 | !759 |
2 | |
3 | // deterministic even |
4 | static boolean safe(Native n) { |
5 | if (n.match("[X] = snlTok(in S Y)")) yo { |
6 | n.set("X", listToSNLTree(codeTokensOnly(snlTok(n.str())))); |
7 | ret true; |
8 | } |
9 | |
10 | if (n.match("the < opsplit < of < in X < is < Y")) yo { |
11 | n.set("Y", snlSplitOps(n.get())); |
12 | ret true; |
13 | } |
14 | |
15 | if (n.match("true")) yo { |
16 | ret true; |
17 | } |
18 | |
19 | if (n.match("X = X")) yo { |
20 | ret true; |
21 | } |
22 | |
23 | if (n.match("isLeaf(in X)")) yo { |
24 | ret n.get().isEmpty(); |
25 | } |
26 | |
27 | if (n.match("X = head(in Y)")) yo { |
28 | n.set("X", n.get().head); |
29 | ret true; |
30 | } |
31 | |
32 | if (n.match("X = args(in Y)")) yo { |
33 | n.set("X", listToSNLTree(n.get().args)); |
34 | ret true; |
35 | } |
36 | |
37 | if (n.match("X = lisp(in Y)")) yo { |
38 | L<Lisp> l = snlParseList(n.get()); |
39 | //print("List found: " + structure(l)); |
40 | if (l.isEmpty()) ret false; |
41 | S head = unquote(l.get(0).raw()); |
42 | L<Lisp> args = dropFirst(l); |
43 | //print("Args: " + structure(args)); |
44 | Lisp result = lisp(head, args); |
45 | //print("Result: " + structure(result)); |
46 | n.set("X", result); |
47 | ret true; |
48 | } |
49 | |
50 | ret false; |
51 | } |
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: | 833 / 1357 |
Referenced in: | [show references] |