<commit_before>'use strict';

var core = require('ceci-core');
var cf = require('../index');

var infiniteRange = function*(start) {
  for (var i = start; ; i += 1)
    yield i;
};

var numbers = function() {
  return cf.source(infiniteRange(1));
};

var plus = function(a, b) { return a + b; };
var times = function(a, b) { return a * b; };


core.chain(null,

           'Integers:', console.log,
           numbers,
           [cf.take, 10], [cf.each, console.log],
           '', console.log,

           'Triangle numbers:', console.log,
           numbers, [cf.reductions, plus],
           [cf.take, 10], [cf.each, console.log],
           '', console.log,

           'Tetrahedral numbers:', console.log,
           numbers, [cf.reductions, plus], [cf.reductions, plus],
           [cf.take, 10], [cf.each, console.log],
           '', console.log,

           'Factorials:', console.log,
           numbers, [cf.reductions, times],
           [cf.take, 10], [cf.each, console.log]);<commit_msg>adjust reductions example to work with new code<commit_after>'use strict';

var core = require('ceci-core');
var cf = require('./src/experimental');

var infiniteRange = function*(start) {
  for (var i = start; ; i += 1)
    yield i;
};

var numbers = function() {
  return cf.source(infiniteRange(1));
};

var plus = function(a, b) { return a + b; };
var times = function(a, b) { return a * b; };


core.chain(null,

           'Integers:', console.log,
           numbers,
           [cf.take, 10], [cf.each, console.log],
           ' ', console.log,

           'Triangle numbers:', console.log,
           numbers, [cf.reductions, [plus, 0]],
           [cf.take, 10], [cf.each, console.log],
           '', console.log,

           'Tetrahedral numbers:', console.log,
           numbers,
           [cf.reductions, [plus, 0]],
           [cf.reductions, [plus, 0]],
           [cf.take, 10], [cf.each, console.log],
           '', console.log,

           'Factorials:', console.log,
           numbers, [cf.reductions, [times, 1]],
           [cf.take, 10], [cf.each, console.log]);
{'fraction_non_alphanumeric': 0.17582417582417584, 'fraction_numerical': 0.011466794075489728, 'mean_word_length': 2.167927382753404, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '5794036', 'n_tokens_mistral': 700, 'n_tokens_neox': 674, 'n_words': 170}