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)

long parrot = 443 /*446*/; // module ID
embedded S firstLine() { ret (S) dm_rcall firstLine(parrot); }
embedded int numLines() { ret (int) dm_rcall numLines(parrot); }
LS rawLines = cast dm_rcall rawLines(parrot);
embedded ItIt<Int> lineCounter() { ret countIterator_exclusive(numLines()+2); }
embedded void checkGuess(IF1<Int, S> makeLine) {
  LS guess = map(lineCounter(), makeLine);
  print(guess);
  if (eq(takeFirst(guess, numLines()), rawLines)) {
    print("Solution: " + guess);
    dm_rcall suggest(parrot, get(guess, numLines()));
  }
}

// This is the code that is to be found
// by combining the 4 functions:
  
for (S s : allUniqueSubstrings(firstLine()))
  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: 200 / 212
Referenced in: [show references]