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

25
LINES

< > BotCompany Repo | #1003032 // Solve "how long is this list"

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

Libraryless. Click here for Pure Java version (2008L/14K/44K).

!759

p {
  Case c = ioioiParse("#1003022");

  S[] e1 = first(c.stringExamples());
  F<S, S> pat = makePattern(str(process(e1[0])), e1[1]);
  
  for (S[] e : c.stringExamples())
    if (!ioSmartEqVerbose(e[1], pat.get(str(process(e[0])))))
      fail("nope");
  print("yo! solved this.");
}

static int process(S in) {
  ret count(javaTok(in), ",") + 1;
}

static F<S, S> makePattern(S in, S out) {
  ret new F<S, S>() {
    S get(S in) {
      ret in + " items"; // TODO
    }
  };
}

Author comment

Began life as a copy of #1003024

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: #1003032
Snippet name: Solve "how long is this list"
Eternal ID of this version: #1003032/1
Text MD5: 30abceaf6f4a66fe47e92d4567560bf5
Transpilation MD5: 94101422c184decd57430b122dfbc066
Author: stefan
Category: javax / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-21 17:22:24
Source code size: 509 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 720 / 753
Referenced in: [show references]