<commit_before>(function(){

  function example_tick() {
    // assumes existence of process.nextTick(), so in browser only works if something
    // else (such as browserify) has created a process.nextTick(). use $async:pause for
    // places w/o process.nextTick
    $async:tick;
    doSomething();
  }

  function example_pause() {
    // uses process.nextTick() if avail, falls back to setTimeout
    $async:pause;
    doSomething();
  }

  function example_sleep() {
    console.log("will sleep 125 ms");
    $async:sleep(125);
    console.log("will sleep 250 ms");
    $async:sleep(250 ms);
    console.log("will sleep 500 ms");
    $async:sleep(0.5 sec);
    console.log("will sleep 1000 ms");
    $async:sleep(1 s);
    console.log("done!");
  }

  function example_var(filename, callback) {
    $async:var data = fs.readFile( filename, -->callback );
    callback(null, data);
  }

  function still_testing() {
    // getting closer but for both block/wait i need a way to make them
    // auto-error-generate-y with -->callback, which $arrows doesnt do yet
    // prolly need
    //   $arrows(_next _err $tokens...)
    // rather than
    //   $arrows(_next $tokens)
    // or maybe $arrows(_next, _err) { $tokens...} at this point just to clean it a bit?
    // or maybe $async<callback>:block or $async:block<callback>;
    if (true) $async:block {
      doSomethingAsync( --> );
    }

    $async:wait {
      doSomethingElseAsync( --> );
    }

    $async:tick;

    // hopefully once the above two work,
    // $async:if and $async:for can use $async:block internally
    /*
    $async:if (foo > 4) {
      dontDoAnything(-->);
    } else if (foo < 2) {
      seriousPleaseDont(-->);
    } else {
      stopDoingThings(-->);
    }

    $async:for (var i = 0; i < 10; i++) {

    }

    // these should not have the same name but idk what to call them
    // for ary vs obj for asyng equivs of (for i in / for i of)
    $async:each (ary    -> v) { ... }
    $async:each (ary[i] -> v) { ... }

    $async:each (obj    -> v) { ... }
    $async:each (obj[k] -> v) { ... }

    */
  }

  module.exports = example;
}).call();
<commit_msg>better var examples, show :sleep() with no args<commit_after>(function(){

  function example_tick() {
    // assumes existence of process.nextTick(), so in browser only works if something
    // else (such as browserify) has created a process.nextTick(). use $async:pause for
    // places w/o process.nextTick
    $async:tick;
    doSomething();
  }

  function example_pause() {
    // uses process.nextTick() if avail, falls back to setTimeout
    $async:pause;
    doSomething();
  }

  function example_sleep() {
    // with no argument, async:sleep() is an alias for $async:pause
    console.log("nextTick/setTimeout 0!");
    $async:sleep();
    console.log("will sleep 125 ms");
    $async:sleep(125);
    console.log("will sleep 250 ms");
    $async:sleep(250 ms);
    console.log("will sleep 500 ms");
    $async:sleep(0.5 sec);
    console.log("will sleep 1000 ms");
    $async:sleep(1 s);
    console.log("done!");
  }

  function example_var(filename, callback) {
    // without an error in the callback
    $async:var (exists) = fs.exists( filename, --> );

    if (! exists) {
      return callback(new Error("File doesn't exist!"));
    }

    // the above is shorthand for this : (dropping the parens implicitly
    // adds the error callback for you)
    $async:var (error, data) = fs.readFile( filename, --> );
    if (error) { return callback(error); }

    // if you use the -->callback form, we'll do error propogation for you:
    $async:var data2 = fs.readFile( filename, -->callback );



    callback(null, data);
  }

  function still_testing() {
    // getting closer but for both block/wait i need a way to make them
    // auto-error-generate-y with -->callback, which $arrows doesnt do yet
    // prolly need
    //   $arrows(_next _err $tokens...)
    // rather than
    //   $arrows(_next $tokens)
    // or maybe $arrows(_next, _err) { $tokens...} at this point just to clean it a bit?
    // or maybe $async<callback>:block or $async:block<callback>;
    if (true) $async:block {
      doSomethingAsync( --> );
    }

    $async:wait {
      doSomethingElseAsync( --> );
    }

    $async:tick;

    // hopefully once the above two work,
    // $async:if and $async:for can use $async:block internally
    /*
    $async:if (foo > 4) {
      dontDoAnything(-->);
    } else if (foo < 2) {
      seriousPleaseDont(-->);
    } else {
      stopDoingThings(-->);
    }

    $async:for (var i = 0; i < 10; i++) {

    }

    // these should not have the same name but idk what to call them
    // for ary vs obj for asyng equivs of (for i in / for i of)
    $async:each (ary    -> v) { ... }
    $async:each (ary[i] -> v) { ... }

    $async:each (obj    -> v) { ... }
    $async:each (obj[k] -> v) { ... }

    */
  }

  module.exports = example;
}).call();

{'fraction_non_alphanumeric': 0.1547185095180235, 'fraction_numerical': 0.011340623734305387, 'mean_word_length': 2.4227304227304227, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '705700', 'n_tokens_mistral': 1655, 'n_tokens_neox': 1550, 'n_words': 491}