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

32
LINES

< > BotCompany Repo | #1003053 // Load All Poems

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1743L/12K/39K).

!752

sclass Text {
  S title;
  new L<S> lines;
}

static new L<Text> texts;

p {
  L<Snippet> snippets = listSnippetsOfType(48); // "Natural Language"
  
  for (Snippet sn : snippets) pcall {
    if (parseSnippetID(sn.id) < 1003000) break;
    
    L<S> lines = toLinesFullTrim(loadSnippet(sn.id));
  
    int i = 0;
    while (i < l(lines)) {
      assertTrue(lines.get(i+1).startsWith("-"));
      new Text text;
      text.title = lines.get(i);
      i += 2;
      while (i < l(lines) &&
        (i+1 >= l(lines) || !lines.get(i+1).startsWith("-")))
        text.lines.add(lines.get(i++));
      texts.add(text);
    }
  }
  
  print("Got " + n(l(texts), "text") + " (" + structure(collect(texts, "title")) + ")");
}

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: #1003053
Snippet name: Load All Poems
Eternal ID of this version: #1003053/1
Text MD5: d27df190dd6ca2f5af68b243d92c2877
Transpilation MD5: bd9b230aa23f14576b29f84338f640bb
Author: stefan
Category: eleu / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-27 01:51:30
Source code size: 752 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 522 / 555
Referenced in: [show references]