1 | sclass SelectBot<A> extends Concept { |
2 | new TreeMap<S, A> examples; |
3 | new TreeMap<S, A> guessed; |
4 | transient S lastMatch; |
5 | |
6 | void put(S s, A value) { |
7 | examples.put(s, value); |
8 | guessed.remove(s); |
9 | change(); |
10 | } |
11 | |
12 | A get(S s) { |
13 | lastMatch = guess(s); |
14 | A value = mapGet(examples, lastMatch); |
15 | if (neq(lastMatch, s)) |
16 | if (mapPutIfChange(guessed, s, value)) change(); |
17 | ret value; |
18 | } |
19 | |
20 | S guess(S s) { |
21 | ret levenClosestIC(examples, s); |
22 | } |
23 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, jtubtzbbkimh, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1008054 |
Snippet name: | SelectBot |
Eternal ID of this version: | #1008054/13 |
Text MD5: | de015b868cf4f0567a658138405e6c33 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-04-23 13:53:21 |
Source code size: | 491 bytes / 23 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 712 / 1322 |
Version history: | 12 change(s) |
Referenced in: | [show references] |