Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

18
LINES

< > BotCompany Repo | #1002740 // snlRemoveReferences

JavaX fragment (include)

1  
static Lisp snlRemoveReferences(Lisp tree) {
2  
  if (tree == null || tree.size() == 0) ret tree;
3  
4  
  Lisp sub = tree.get(tree.size()-1);
5  
  if (snlIsRef(sub))
6  
    if (tree.size() == 1) // it [= x]
7  
      ret lisp(dropSuffix(" *", tree.head));
8  
    else if (tree.size() == 2) // [bla] [= x]
9  
      ret tree.get(0);
10  
    else
11  
      ret tree; // not handled
12  
13  
  // recurse
14  
  Lisp lisp = new Lisp(tree.head);
15  
  for (Lisp child : tree)
16  
    lisp.add(snlRemoveReferences(child));
17  
  ret lisp;
18  
}

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: #1002740
Snippet name: snlRemoveReferences
Eternal ID of this version: #1002740/1
Text MD5: 938209f449a0e6ad948beeb30e999cee
Author: stefan
Category: eleu / nl
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-19 02:28:05
Source code size: 494 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 585 / 581
Referenced in: [show references]