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

16
LINES

< > BotCompany Repo | #1011390 // webToStringShort (one line)

JavaX fragment (include)

static S webToStringShort(Web web) {
  try {
    if (web == null) ret "-";
    int n = l(web_nodes(web));
    if (n == 0) ret "Empty web";
    WebNode a = web_firstNode(web);
    if (n == 1) ret join(" = ", web_texts(a));
    if (n == 2) {
      WebNode b = web_secondNode(web);
      ret ai_renderTriple(web_text(a), web_text(web_getRelation(a, b)), web_text(b));
    }
    ret "Includes " + joinWithComma(map web_text(web_nodes(web)));
  } catch print e {
    ret "Error";
  }
}

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: #1011390
Snippet name: webToStringShort (one line)
Eternal ID of this version: #1011390/7
Text MD5: 6e2a250729e302a4b5031144852cc22d
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-22 08:18:30
Source code size: 495 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 503 / 512
Version history: 6 change(s)
Referenced in: [show references]