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

!7

sclass Blob {
  L<Pair<S>> items = new L;
}

static new Map<S, Blob> blobs;

p {
  blobs.put("nasty", parseBlob([[something nasty -> You're an asshole]]));
  printStruct(blobs);
  assertEqualsVerbose("You're an asshole", blobLookupIC(blobs.get("nasty"), "Something nasty"));
  print("OK");
}

static Blob parseBlob(S s) {
  new Blob blob;
  for (S line : toLinesFullTrim(s)) {
    L<S> l = splitAtSimpleArrow(line);
    if (l(l) == 2)
      blob.items.add(mapPair(f trim, listToPair(l)));
  }
  ret blob;
}

static S blobLookupIC(Blob blob, S key) {
  if (blob != null)
    for (Pair<S> p : blob.items)
      if (eqic(p.a, key)) ret p.b;
  null;
}

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: 368 / 440
Version history: 4 change(s)
Referenced in: [show references]