Libraryless. Click here for Pure Java version (1920L/14K/43K).
!759 !include #1002412 // Turing static void tests() { elements(); } static void elements() { repeat 5 { L<S> l = randomList(); add(format3("how many elements are in the list *?", l), l(l)); } repeat 2 { L<S> l = randomList(2, 4); add(format3("what is the first element in the list *?", l), first(l)); add(format3("what is the last element in the list *?", l), last(l)); add(format3("what is the 2nd element in the list *?", l), get(l, 1)); } } static L<S> randomList() { int n = rand(5); ret randomList(n, n); } static L<S> randomList(int minLen, int maxLen) { int n = minLen + rand(maxLen-minLen+1); new L<S> l; repeat n { l.add(randomID(1)); } ret l; }
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: | #1002413 |
Snippet name: | Turing Tests: List Processing |
Eternal ID of this version: | #1002413/1 |
Text MD5: | b52ff408c390636e183d1ebdf7bfa2c8 |
Transpilation MD5: | d8c76bd79db67ab7cd1b864504eddb4f |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-01-20 18:00:25 |
Source code size: | 743 bytes / 33 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 727 / 2027 |
Referenced in: | [show references] |