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

13
LINES

< > BotCompany Repo | #1011554 // ai_subst_web

JavaX fragment (include)

1  
static S ai_subst_web(S webID) {
2  
  int n = websMadeInThread();
3  
  Web web = assertNotNull("Web not found: " + webID, ai_getWeb(webID));
4  
  WebRelation rel = assertNotNull(web_findRelationNamed(web, "matches"));
5  
  S pat = web_unquoted(rel.a), input = web_unquoted(rel.b);
6  
  assertEquals("substitute * => * with *", pat);
7  
  new Matches m;
8  
  assertTrue(flexMatchIC(pat, input, m));
9  
  S src = unquote(m.get(0));
10  
  L<S> terms = unquoteAll(trimAll(splitAtJavaToken(m.get(1), ",")));
11  
  ai_postTriple_multi(src, "see:", terms);
12  
  ret nWebs(websMadeInThread()-n) + " made";
13  
}

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: #1011554
Snippet name: ai_subst_web
Eternal ID of this version: #1011554/5
Text MD5: 86adea64962e229db01de813c9fd27fb
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-26 20:43:59
Source code size: 576 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 439 / 472
Version history: 4 change(s)
Referenced in: [show references]