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

33
LINES

< > BotCompany Repo | #1021109 // Actual Words CRUD

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Uses 911K of libraries. Click here for Pure Java version (12128L/65K).

1  
!7
2  
3  
concept Entry {
4  
  S word;
5  
  S isWord; // 'yes, 'no, other
6  
  S comment;
7  
}
8  
9  
cmodule ActualWords > DynCRUD<Entry> {
10  
  start {
11  
    dbIndexing(Entry, 'word);
12  
  }
13  
  
14  
  // API
15  
  
16  
  void addWordsWithComment(Iterable<S> words, S comment) {
17  
    for (S word : words) {
18  
      Entry e = uniq_sync Entry(+word, isWord := 'yes);
19  
      cset(e, comment := joinNemptiesWithComma(e.comment, comment));
20  
    }
21  
  }
22  
  
23  
  S randomWord() {
24  
    for ping (Entry e : shuffledIterator(concepts()))
25  
      if (isYes(e.isWord))
26  
        ret e.word;
27  
    null;
28  
  }
29  
  
30  
  LS actualWords() {
31  
    ret collect word(filter(concepts(), func(Entry e) -> bool { isYes(e.isWord) }));
32  
  }
33  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1021109
Snippet name: Actual Words CRUD
Eternal ID of this version: #1021109/8
Text MD5: b8f5f653d6cd80c0fd95080502bd9922
Transpilation MD5: c9c602cbb60eeb197d4e4684e6d7f02d
Author: stefan
Category: javax
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-23 21:02:38
Source code size: 680 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 393 / 1415
Version history: 7 change(s)
Referenced in: [show references]