1 | static L<L<S>> gLearns() {
|
2 | ret gLearns(gLog()); |
3 | } |
4 | |
5 | // return latest learns first! |
6 | static L<L<S>> gLearns(L<S> log) {
|
7 | L<L<S>> parts = new L; |
8 | for (int i = l(log)-1; i >= 0; i--) {
|
9 | S cmd = log.get(i); |
10 | continue unless cmd.startsWith("!learn"); // fancy new "unless" syntax!
|
11 | new Matches mm; |
12 | continue unless match("!learn *-*", log.get(i), mm);
|
13 | int m = mm.psi(0), n = mm.psi(1); |
14 | //print("i=" + i +", m=" + m + ", n=" + n);
|
15 | L<S> part = subList(log, i-n, i-m+1); |
16 | parts.add(part); |
17 | } |
18 | ret parts; |
19 | } |
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: | 852 / 827 |
| Referenced in: | [show references] |