Libraryless. Click here for Pure Java version (540L/4K/14K).
1 | !752 |
2 | |
3 | m { |
4 | // it's one engine for two-word sentences, one for three-word |
5 | // sentences - but it could be anything, really. |
6 | // the point is to show how simply they can be combined. |
7 | |
8 | static L<S> engineIDs = litlist("#1001841", "#1001844"); |
9 | |
10 | static new L<Class> engines; |
11 | |
12 | p { |
13 | for (S engineID : engineIDs) |
14 | engines.add(hotwire(engineID)); |
15 | print(l(engines) + " engine(s) loaded."); |
16 | askMyself("assert honk isA bonk"); |
17 | assertEquals("1", askMyself("query honk isA bonk")); |
18 | assertEquals("0", askMyself("query bonk isA honk")); |
19 | print("OK!"); |
20 | } |
21 | |
22 | static S answer(S s) { |
23 | for (Class engine : engines) |
24 | pcall { |
25 | S result = callStaticAnswerMethod(engine, s); |
26 | if (result != null) ret result; |
27 | } |
28 | ret null; |
29 | } |
30 | } |
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001845 |
Snippet name: | Combine logic engines (works) |
Eternal ID of this version: | #1001845/1 |
Text MD5: | 2cd565f12f7556214ad05721b9429d08 |
Transpilation MD5: | d0c6417f5e04d72cac3aaa99a9cc6261 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-12-03 16:49:55 |
Source code size: | 806 bytes / 30 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 824 / 1254 |
Referenced in: | [show references] |