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).

1  
!752
2  
3  
sclass Text {
4  
  S title;
5  
  new L<S> lines;
6  
}
7  
8  
static new L<Text> texts;
9  
10  
p {
11  
  L<Snippet> snippets = listSnippetsOfType(48); // "Natural Language"
12  
  
13  
  for (Snippet sn : snippets) pcall {
14  
    if (parseSnippetID(sn.id) < 1003000) break;
15  
    
16  
    L<S> lines = toLinesFullTrim(loadSnippet(sn.id));
17  
  
18  
    int i = 0;
19  
    while (i < l(lines)) {
20  
      assertTrue(lines.get(i+1).startsWith("-"));
21  
      new Text text;
22  
      text.title = lines.get(i);
23  
      i += 2;
24  
      while (i < l(lines) &&
25  
        (i+1 >= l(lines) || !lines.get(i+1).startsWith("-")))
26  
        text.lines.add(lines.get(i++));
27  
      texts.add(text);
28  
    }
29  
  }
30  
  
31  
  print("Got " + n(l(texts), "text") + " (" + structure(collect(texts, "title")) + ")");
32  
}

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: 524 / 557
Referenced in: [show references]