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

18
LINES

< > BotCompany Repo | #1014567 // mL_answerWithCodeFragments

JavaX fragment (include)

1  
sS mL_answerWithCodeFragments(S s) {
2  
  ret mL_answerWithCodeFragments("Questions to AI => Answers with code fragments", s);
3  
}
4  
5  
sS mL_answerWithCodeFragments(S listName, S s) {
6  
  Pair<S, Matches> answer = lookupNL_dollarVars_dontExpand(mechMap(listName), s);
7  
  if (answer == null) null;
8  
  
9  
  L<S> tok = javaTokWithAngleBrackets(answer.a);
10  
  for (int i = 1; i < l(tok); i += 2) {
11  
    S t = tok.get(i);
12  
    if (isAngleBracketed(t))
13  
      tok.set(i, structOrText(javaEval(mL_expandFunctionNames(expandDollarRefsToMatches_alwaysQuote(deAngleBracket(t), answer.b)))));
14  
    else
15  
      tok.set(i, expandDollarRefsToMatches(t, answer.b));
16  
  }
17  
  ret join(tok);
18  
}

Author comment

Began life as a copy of #1014454

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: #1014567
Snippet name: mL_answerWithCodeFragments
Eternal ID of this version: #1014567/5
Text MD5: 87120bfc0b5b3c2542daea663fb92384
Author: stefan
Category: javax / a.i. / web
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-04-24 12:18:58
Source code size: 669 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 373
Version history: 4 change(s)
Referenced in: [show references]