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

40
LINES

< > BotCompany Repo | #1026485 // Suffixes/Prefixes Continuation Framework Spike [dev.]

JavaX source code (Dynamic Module) - run with: Stefan's OS

!7

abstract sclass Continuation {
}

srecord Parallel(Continuation *options) > Continuation {
}

cmodule ContinuationTest > DynPrintLog {
  transient LS
    prefixes = ll("un", "pre"),
    suffixes = ll("able", "like");

  start-thread {
    processInput("unrepairable");
  }
  
  // original version without continuations
  void processInput(S input) {
    for (S s : prefixes)
      if (swic(input, s))
        emit(joinPairWithSpace(pairOfNFirstAndRest(input, l(s))));
    for (S s : suffixes)
      if (ewic(input, s))
        emit(joinPairWithSpace(pairOfRestAndNLast(input, l(s))));
  }
  
  Continuation processInput2(S input) {
    ret Parallel(
      ParallelFor(prefixes, s -> {
        if (swic(input, s))
          emit(joinPairWithSpace(pairOfNFirstAndRest(input, l(s))))
      }),
      ParallelFor(suffixes, s -> {
        if (ewic(input, s))
          emit(joinPairWithSpace(pairOfRestAndNLast(input, l(s))));
      })
    );
  }
}

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: #1026485
Snippet name: Suffixes/Prefixes Continuation Framework Spike [dev.]
Eternal ID of this version: #1026485/1
Text MD5: 8ecb616a51e10c71b591a9d2a1067e2e
Author: stefan
Category: javax / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-01-06 16:26:56
Source code size: 987 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 144 / 178
Referenced in: