Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

19
LINES

< > BotCompany Repo | #1026844 // Parrot Ad-Hoc Code (from https://www.youtube.com/watch?v=d7XWxMnIUpM)

JavaX fragment (include)

1  
long parrot = 443 /*446*/; // module ID
2  
embedded S firstLine() { ret (S) dm_rcall firstLine(parrot); }
3  
embedded int numLines() { ret (int) dm_rcall numLines(parrot); }
4  
LS rawLines = cast dm_rcall rawLines(parrot);
5  
embedded ItIt<Int> lineCounter() { ret countIterator_exclusive(numLines()+2); }
6  
embedded void checkGuess(IF1<Int, S> makeLine) {
7  
  LS guess = map(lineCounter(), makeLine);
8  
  print(guess);
9  
  if (eq(takeFirst(guess, numLines()), rawLines)) {
10  
    print("Solution: " + guess);
11  
    dm_rcall suggest(parrot, get(guess, numLines()));
12  
  }
13  
}
14  
15  
// This is the code that is to be found
16  
// by combining the 4 functions:
17  
  
18  
for (S s : allUniqueSubstrings(firstLine()))
19  
  checkGuess(n -> concatTwoStrings_gen(s, plus1(n)));

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1026844
Snippet name: Parrot Ad-Hoc Code (from https://www.youtube.com/watch?v=d7XWxMnIUpM)
Eternal ID of this version: #1026844/1
Text MD5: e401287bdde19abba9db037b02a2596d
Author: stefan
Category: javax / html
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-26 19:39:15
Source code size: 742 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 125 / 141
Referenced in: [show references]