Libraryless. Click here for Pure Java version (1300L/9K/32K).
1 | !7 |
2 | |
3 | sS text1 = [[ |
4 | Consider the string "abc" |
5 | How long is it? |
6 | 3 characters |
7 | ]], text2 = [[ |
8 | Consider the string "johnnie" |
9 | How long is it? |
10 | 7 characters |
11 | ]]; |
12 | |
13 | sS tester = [[ |
14 | Consider the string "Hello World" |
15 | How long is it? |
16 | ]]; |
17 | sS testerAnswer = [[ |
18 | 11 characters |
19 | ]]; |
20 | |
21 | sS tester2 = [[ |
22 | Consider the string "Hello World" |
23 | ]]; |
24 | |
25 | static L functionsToUse = ll(f lstrAfterUnquote); |
26 | static O solver; // func(S) -> S |
27 | |
28 | p { |
29 | solver = ai_relateTwoTokens(text1, text2, functionsToUse, false); |
30 | print("Tester: " + quote(tester)); |
31 | S answer = cast callF(solver, tester); |
32 | print("Answer: " + quote(answer)); |
33 | assertTrue(codeTokensEqual(testerAnswer, answer)); |
34 | print("Yo!"); |
35 | |
36 | print("Tester 2: " + quote(tester2)); |
37 | solver = ai_relateTwoTokens(text1, text2, functionsToUse, true); |
38 | answer = (S) callF(solver, tester2); |
39 | print("Answer:\n" + indentx(answer) + "\n"); |
40 | } |
Began life as a copy of #1009489
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009497 |
Snippet name: | Test ai_relateTwoTokens [OK] |
Eternal ID of this version: | #1009497/6 |
Text MD5: | 9dda008780baaa3facd765dbe678841f |
Transpilation MD5: | 07bf66ac6225b3e80d18d83fa16476b6 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-04 18:10:39 |
Source code size: | 892 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 504 / 597 |
Version history: | 5 change(s) |
Referenced in: | [show references] |