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

19
LINES

< > BotCompany Repo | #1010956 // chatLinesAsWeb2

JavaX fragment (include)

// a, b are indices into the chat history
static Web chatLinesAsWeb2(int a, int b, O makeNode) {
  ret chatLinesAsWeb2(stefansChat_readHistory_fullMsgs(a, b), makeNode);
}

// makeNode: voidfunc(ChatMsg, WebNode)
static Web chatLinesAsWeb2(L<ChatMsg> msgs, O makeNode) {
  Web web = simpleWeb();
  new L<WebNode> nodes;
  for i over msgs: {
    ChatMsg msg = msgs.get(i);
    WebNode n = web.newNode();
    web_addRelation(last(nodes), n, 'then);
    web_setPosition(n, 0.5, 0.2+i*0.6/max(1, l(msgs)-1));
    nodes.add(n);
    pcallF(makeNode, msg, n);
  }
  ret web;
}

Author comment

Began life as a copy of #1010919

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: #1010956
Snippet name: chatLinesAsWeb2
Eternal ID of this version: #1010956/6
Text MD5: bb0d94bc2262bb10c1dffbf06c340e9b
Author: stefan
Category: javax / chat / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-10-10 18:41:35
Source code size: 587 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 370
Version history: 5 change(s)
Referenced in: [show references]