sclass SelectBot<A> extends Concept { new TreeMap<S, A> examples; new TreeMap<S, A> guessed; transient S lastMatch; void put(S s, A value) { examples.put(s, value); guessed.remove(s); change(); } A get(S s) { lastMatch = guess(s); A value = mapGet(examples, lastMatch); if (neq(lastMatch, s)) if (mapPutIfChange(guessed, s, value)) change(); ret value; } S guess(S s) { ret levenClosestIC(examples, s); } }
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: | 998 / 1601 |
| Version history: | 12 change(s) |
| Referenced in: | #1008066 - SelectBot using "match" method #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674) |