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

31
LINES

< > BotCompany Repo | #1008582 // Arrow Blobs [OK]

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

Libraryless. Click here for Pure Java version (1744L/12K/41K).

1  
!7
2  
3  
sclass Blob {
4  
  L<Pair<S>> items = new L;
5  
}
6  
7  
static new Map<S, Blob> blobs;
8  
9  
p {
10  
  blobs.put("nasty", parseBlob([[something nasty -> You're an asshole]]));
11  
  printStruct(blobs);
12  
  assertEqualsVerbose("You're an asshole", blobLookupIC(blobs.get("nasty"), "Something nasty"));
13  
  print("OK");
14  
}
15  
16  
static Blob parseBlob(S s) {
17  
  new Blob blob;
18  
  for (S line : toLinesFullTrim(s)) {
19  
    L<S> l = splitAtSimpleArrow(line);
20  
    if (l(l) == 2)
21  
      blob.items.add(mapPair(f trim, listToPair(l)));
22  
  }
23  
  ret blob;
24  
}
25  
26  
static S blobLookupIC(Blob blob, S key) {
27  
  if (blob != null)
28  
    for (Pair<S> p : blob.items)
29  
      if (eqic(p.a, key)) ret p.b;
30  
  null;
31  
}

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: #1008582
Snippet name: Arrow Blobs [OK]
Eternal ID of this version: #1008582/5
Text MD5: c69812f989061c4c5c7c14332bac9638
Transpilation MD5: 05131d4c362a4e4adb51795396520167
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-24 17:22:56
Source code size: 681 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 444 / 545
Version history: 4 change(s)
Referenced in: [show references]