Libraryless. Click here for Pure Java version (1591L/11K/36K).
!752 static L<E> poem; // reference poem p { L<Text> texts = loadPoems("#1003064"); // Simple Poem poem = parsePoem(texts.get(0).lines); printStructure(poem); L<E> test = parsePoem(texts.get(1).lines); printStructure(test); L<E> failingTest = parsePoem(texts.get(2).lines); printStructure("Failing test: ", failingTest); S input = "q: are you on? "; L<E> inp = parsePoem(input); printStructure("Input: ", inp); printStructure("Prediction: ", predict(inp)); print("Test: " + assertTrue(runPoemTest1(test))); print("Failing test: " + assertFalse(runPoemTest1(failingTest))); print("OK!"); } // used by runPoemTest1 static L<E> predict(L<E> input) { int n = l(input); if (l(poem) < n) ret null; // poem too short for (int i = 0; i < n; i++) { E x = poem.get(i), y = input.get(i); if (!x.eqTo(y)) ret null; } ret subList(poem, n); }
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: | #1003065 |
Snippet name: | Test Simple Poem |
Eternal ID of this version: | #1003065/1 |
Text MD5: | c972833b7083d343bb8c80a44809a80a |
Transpilation MD5: | aa15212a888910277f02a647ec54724b |
Author: | stefan |
Category: | eleu / nl |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-27 16:06:29 |
Source code size: | 950 bytes / 41 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 636 / 698 |
Referenced in: | #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |