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

18
LINES

< > BotCompany Repo | #1002740 // snlRemoveReferences

JavaX fragment (include)

static Lisp snlRemoveReferences(Lisp tree) {
  if (tree == null || tree.size() == 0) ret tree;

  Lisp sub = tree.get(tree.size()-1);
  if (snlIsRef(sub))
    if (tree.size() == 1) // it [= x]
      ret lisp(dropSuffix(" *", tree.head));
    else if (tree.size() == 2) // [bla] [= x]
      ret tree.get(0);
    else
      ret tree; // not handled

  // recurse
  Lisp lisp = new Lisp(tree.head);
  for (Lisp child : tree)
    lisp.add(snlRemoveReferences(child));
  ret lisp;
}

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: 584 / 580
Referenced in: #1002742 - snlQuestionMarksToBack - and other punctuation
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)