<commit_before>"use strict";


// The library for general signal manipulation. Includes `lift` function
// (that supports up to 8 inputs), combinations, filters, and past-dependence.
//
// Signals are time-varying values. Lifted functions are reevaluated whenver
// any of their input signals has an event. Signal events may be of the same
// value as the previous value of the signal. Such signals are useful for
// timing and past-dependence.
//
// Some useful functions for working with time (e.g. setting FPS) and combining
// signals and time (e.g. delaying updates, getting timestamps) can be found in
// the Time library.

var slicer = Array.prototype.slice

function Meta(value) {
  return this.value = value
}
Meta.prototype.valueOf = function() {
  return this.value
}

var Break = new Meta(null)
var Skip = new Meta(null)

function Return(value) {
  if (!(this instanceof Return))
    return new Return(value)

  this.value = value
}
Return.prototype = new Meta()


function Signal(generator, initial) {
  if (!(this instanceof Signal))
    return new Signal(generator, initial)

  this.value = initial
  this.generate = generator
}
Signal.Return = Return
Signal.return = Return
Signal.Skip = Skip
Signal.Break = Break


function dispatch(signal) {
  return function dispatch(value) {
    var result = void(0)
    // Optimal case with a single receiver.
    if (signal.receive) {

      result = signal.receive(value, signal)
      signal.value = value
      if (result === Break) signal.receive = null
    }
    // If multiple receivers are subscribed dispatches `value` to eoch one.
    else if (signal.receivers) {
      var receivers = signal.receivers
      var count = receivers.length
      var index = 0

      // Dispatch updated signal `value` to an every customer of this `signal`.
      while (index < count) {
        var receive = receivers[index]

        // If customer wishes to unsubscribe from updates
        // remove it from the set.
        if (receive(value, signal) === Break) {
          receivers.splice(index, 1)
          count = count - 1
        }
        // Otherwise increment index, to send value to a
        // next customer.
        else {
          index = index + 1
        }
      }
      signal.value = value
      // If no more receivers `Break` the generator.
      result = receivers.length ? void(0) : Break
    }
    else {
      result = Break
    }
    return result
  }
}
// Internal field used for holding set of customers
// when `.dispatch` is used for sending values.
Signal.prototype.receivers = null
Signal.prototype.receive = null
Signal.prototype.valueOf = function() {
  return this.value
}

exports.Signal = Signal


// Takes `run` function, `xs` signal and invokes
// `run` with every value of `xs`.

// (x) -> Signal x -> nil
function spawn(run, signal) {
  if (!signal) {
    throw TypeError("Can't spawn non signal")
  }
  // If signal has not being spawned yet set a
  // reciver and schedule a generator.
  else if (!signal.receive) {
    signal.receive = run
    setTimeout(signal.generate, 0, dispatch(signal))
  }
  // If signal is already scheduled & there is a
  // single receiver, create an array of active
  // receivers and convert receiver to a dispatcher.
  else if (!signal.receivers) {
    signal.receivers = [signal.receive, run]
    signal.receive = null
  }
  // If signal is already dispatching & there are
  // multiple receivers add new receiver to the
  // array of active receivers.
  else {
    xs.receivers.push(run)
  }
}
exports.spawn = spawn

// # Combine

// Create a constant signal that never changes.

// a -> Signal a
function Constant(value) {<commit_msg>Fix multi-customer case.<commit_after>"use strict";


// The library for general signal manipulation. Includes `lift` function
// (that supports up to 8 inputs), combinations, filters, and past-dependence.
//
// Signals are time-varying values. Lifted functions are reevaluated whenver
// any of their input signals has an event. Signal events may be of the same
// value as the previous value of the signal. Such signals are useful for
// timing and past-dependence.
//
// Some useful functions for working with time (e.g. setting FPS) and combining
// signals and time (e.g. delaying updates, getting timestamps) can be found in
// the Time library.
//
// Module implements elm API: http://docs.elm-lang.org/library/Signal.elm

var slicer = Array.prototype.slice

function Meta(value) {
  return this.value = value
}
Meta.prototype.valueOf = function() {
  return this.value
}

var Break = new Meta(null)
var Skip = new Meta(null)

function Return(value) {
  if (!(this instanceof Return))
    return new Return(value)

  this.value = value
}
Return.prototype = new Meta()


function Signal(generator, initial) {
  if (!(this instanceof Signal))
    return new Signal(generator, initial)

  this.value = initial
  this.generate = generator
}
Signal.Return = Return
Signal.return = Return
Signal.Skip = Skip
Signal.Break = Break
exports.Break = Break


function dispatch(signal) {
  return function dispatch(value) {
    var result = void(0)
    // Optimal case with a single receiver.
    if (signal.receive) {
      result = signal.receive(value, signal)
      signal.value = value
    }
    // If multiple receivers are subscribed dispatches `value` to eoch one.
    else if (signal.receivers) {
      var receivers = signal.receivers
      var count = receivers.length
      var index = 0

      // Dispatch updated signal `value` to an every customer of this `signal`.
      while (index < count) {
        var receive = receivers[index]

        // If customer wishes to unsubscribe from updates
        // remove it from the set.
        try {
          result = receive(value, signal);
        }
        catch (error) {
          console.error(error);
        }

        if (result === Break) {
          receivers.splice(index, 1)
          count = count - 1
        }
        // Otherwise increment index, to send value to a
        // next customer.
        else {
          index = index + 1
        }
      }
      signal.value = value
      // If no more receivers `Break` the generator.
      result = receivers.length ? void(0) : Break
    }
    else {
      result = Break
    }

    if (result === Break) {
      signal.receive = null
      signal.receivers = null
    }

    return result
  }
}
// Internal field used for holding set of customers
// when `.dispatch` is used for sending values.
Signal.prototype.receivers = null
Signal.prototype.receive = null
Signal.prototype.valueOf = function() {
  return this.value
}

exports.Signal = Signal


// Takes `run` function, `xs` signal and invokes
// `run` with every value of `xs`.

// (x) -> Signal x -> nil
function spawn(run, signal) {
  if (!signal) {
    throw TypeError("Can't spawn non signal")
  }
  // If signal is already dispatching & there are
  // multiple receivers add new receiver to the
  // array of active receivers.
  else if (signal.receivers) {
    signal.receivers.push(run)
  }
  // If signal is already scheduled & there is a
  // single receiver, create an array of active
  // receivers and convert receiver to a dispatcher.
  else if (signal.receive) {
    signal.receivers = [signal.receive, run]
    signal.receive = null
  }
  // If signal has not being spawned yet set a
  // reciver and schedule a generator.
  else {
    signal.receive = run
    setTimeout(signal.generate, 0, dispatch(signal))
  }
}
exports.spawn = spawn

// # Combine

// Create a constant signal that never changes.

// a -> Signal a
function Constant(value) {
{'fraction_non_alphanumeric': 0.09948677457560205, 'fraction_numerical': 0.0021055402026582447, 'mean_word_length': 2.632887189292543, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, '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': '7499988', 'n_tokens_mistral': 2205, 'n_tokens_neox': 2108, 'n_words': 821}