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

26
LINES

< > BotCompany Repo | #1005484 // testParse + parseToOptions + iterateOptions

JavaX fragment (include)

1  
svoid testParse(S s) {
2  
  print("** \* s */ **");
3  
  print();
4  
  new L<Concept> l;
5  
  parse(s, listCollector(l));
6  
  for i over l:
7  
    print((i+1) + ". " + structureConcept(l.get(i)));
8  
  
9  
  for (Concept c : iterateOptions(l)) {
10  
    if (properSentence(c)) {
11  
      print("First proper sentence: " + structureConcept(c));
12  
      break;
13  
    }
14  
  }
15  
  print();
16  
}
17  
18  
static Concept parseToOptions(S s) {
19  
  new L<Concept> l;
20  
  parse(s, listCollector(l));
21  
  ret options(l);
22  
}
23  
24  
static Iterable<Concept> iterateOptions(L<Concept> l) {
25  
  ret mapI(l, func(Concept c) { firstOfFirst(c) });
26  
}

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: #1005484
Snippet name: testParse + parseToOptions + iterateOptions
Eternal ID of this version: #1005484/1
Text MD5: 6675562bc342a0206fef53253e436398
Author: stefan
Category: javax / concepts / parsing
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-22 13:22:22
Source code size: 593 bytes / 26 lines
Pitched / IR pitched: No / No
Views / Downloads: 474 / 473
Referenced in: [show references]