static L<L<S>> gLearns() { ret gLearns(gLog()); } // return latest learns first! static L<L<S>> gLearns(L<S> log) { L<L<S>> parts = new L; for (int i = l(log)-1; i >= 0; i--) { S cmd = log.get(i); continue unless cmd.startsWith("!learn"); // fancy new "unless" syntax! new Matches mm; continue unless match("!learn *-*", log.get(i), mm); int m = mm.psi(0), n = mm.psi(1); //print("i=" + i +", m=" + m + ", n=" + n); L<S> part = subList(log, i-n, i-m+1); parts.add(part); } ret parts; }
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003999 |
Snippet name: | gLearns - find contents of !learn commands in log |
Eternal ID of this version: | #1003999/1 |
Text MD5: | c6185f69a22a1d383072b3b6db2dc409 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-10 17:04:52 |
Source code size: | 548 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 613 / 579 |
Referenced in: | [show references] |