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

19
LINES

< > BotCompany Repo | #1014081 // ai_mechList_placeholdersToRandomEntry

JavaX fragment (include)

static S ai_mechList_placeholdersToRandomEntry(S s) {
  ret (S) applyUntilEq(f ai_mechList_placeholdersToRandomEntry_1, s);
}

static S ai_mechList_placeholdersToRandomEntry_1(S s) {
  L<S> tok = javaTokWithAngleBrackets(s);
  for (int i = 1; i < l(tok); i += 2) {
    S t = tok.get(i);
    if (isAngleBracketed(t)) {
      t = deAngleBracket(t);
      S list = or(ai_placeholderToList(t), t);
      L<S> entries = mechList(list);
      if (entries == null)
        fail("No list for <" + t + ">");
      tok.set(i, random(entries));
    }
  }
  ret join(tok);
}

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: #1014081
Snippet name: ai_mechList_placeholdersToRandomEntry
Eternal ID of this version: #1014081/6
Text MD5: aade55200f54cc70c121754684d06efd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-28 22:35:59
Source code size: 584 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 425 / 462
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)