<commit_before>//
//  Hot.swift
//  RxStream
//
//  Created by <NAME> on 3/8/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public class Hot<T> : Stream<T> {
  
  public func on(handler: @escaping (T) -> Bool) -> Hot<T> {
    return append(stream: Hot<T>(), handler: handler)
  }
  
  public func onTransition(handler: @escaping (_ prior: T?, _ next: T) -> Bool) -> Hot<T> {
    return append(stream: Hot<T>(), handler: handler)
  }
  
  public func map<U>(mapper: @escaping (T) -> U?) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func map<U>(mapper: @escaping (T) -> Result<U>) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func map<U>(mapper: @escaping (_ value: T, _ completion: (Result<U>) -> Void) -> Void) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func flatMap<U>(_ mapper: @escaping (T) -> [U]) -> Hot<U> {
    return append(stream: Hot<U>(), withFlatMapper: mapper)
  }
  
  public func scan<U>(initial: U, scanner: @escaping (_ current: U, _ next: T) -> U) -> Hot<U> {
    return append(stream: Hot<U>(), initial: initial, withScanner: scanner)
  }
  
  public func first() -> Hot<T> {
    return appendFirst(stream: Hot<T>())
  }
  
  public func first(_ count: Int, partial: Bool = false) -> Hot<[T]> {
    return appendFirst(stream: Hot<[T]>(), count: count, partial: partial)
  }
  
  public func last() -> Hot<T> {
    return appendLast(stream: Hot<T>())
  }
  
  public func last(_ count: Int, partial: Bool = false) -> Hot<[T]> {
    return appendLast(stream: Hot<[T]>(), count: count, partial: partial)
  }
  
  public func reduce<U>(initial: U, reducer: @escaping (_ current: U, _ next: T) -> U) -> Hot<U> {
    return scan(initial: initial, scanner: reducer).last()
  }
  
  public func buffer(size: Int, partial: Bool = false) -> Hot<[T]> {
    return appendBuffer(stream: Hot<[T]>(), bufferSize: size, partial: partial)
  }
  
  public func window(size: Int, partial: Bool = false) -> Hot<[T]> {
    return appendWindow(stream: Hot<[T]>(), windowSize: size, partial: partial)
  }
  
  public func window(size: TimeInterval, limit: Int? = nil) -> Hot<[T]> {
    return appendWindow(stream: Hot<[T]>(), windowSize: size, limit: limit)
  }
  
  public func filter(include: @escaping (T) -> Bool) -> Hot<T> {
    return appendFilter(stream: Hot<T>(), include: include)
  }
  
  public func stride(_ stride: Int) -> Hot<T> {
    return appendStride(stream: Hot<T>(), stride: stride)
  }
  
  public func timeStamp() -> Hot<(Date, T)> {
    return appendTimeStamp(stream: Hot<(Date, T)>())
  }
  
  public func distinct(_ isDistinct: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendDistinct(stream: Hot<T>(), isDistinct: isDistinct)
  }
 
  public func min(lessThan: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendMin(stream: Hot<T>(), lessThan: lessThan)
  }
  
  public func max(greaterThan: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendMax(stream: Hot<T>(), greaterThan: greaterThan)
  }
  
  public func count() -> Hot<UInt> {
    return appendCount(stream: Hot<UInt>())
  }
  
  public func delay(_ delay: TimeInterval) -> Hot<T> {
    return appendDelay(stream: Hot<T>(), delay: delay)
  }
  
  public func using<U: AnyObject>(_ object: U) -> Hot<(U, T)> {
    return appendUsing(stream: Hot<(U, T)>(), object: object)
  }
  
  public func merge<U>(_ stream: Stream<U>) -> Hot<Either<U, T>> {
    return appendMerge(stream: stream, intoStream: Hot<Either<U, T>>())
  }
  
  public func merge(_ stream: Stream<T>) -> Hot<T> {
    return appendMerge(stream: stream, intoStream: Hot<T>())
  }<commit_msg>- Added concat and startWith functions to Hot<commit_after>//
//  Hot.swift
//  RxStream
//
//  Created by <NAME> on 3/8/17.
//  Copyright © 2017 <NAME>. All rights reserved.
//

import Foundation

public class Hot<T> : Stream<T> {
  
  public func on(handler: @escaping (T) -> Bool) -> Hot<T> {
    return append(stream: Hot<T>(), handler: handler)
  }
  
  public func onTransition(handler: @escaping (_ prior: T?, _ next: T) -> Bool) -> Hot<T> {
    return append(stream: Hot<T>(), handler: handler)
  }
  
  public func map<U>(mapper: @escaping (T) -> U?) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func map<U>(mapper: @escaping (T) -> Result<U>) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func map<U>(mapper: @escaping (_ value: T, _ completion: (Result<U>) -> Void) -> Void) -> Hot<U> {
    return append(stream: Hot<U>(), withMapper: mapper)
  }
  
  public func flatMap<U>(_ mapper: @escaping (T) -> [U]) -> Hot<U> {
    return append(stream: Hot<U>(), withFlatMapper: mapper)
  }
  
  public func scan<U>(initial: U, scanner: @escaping (_ current: U, _ next: T) -> U) -> Hot<U> {
    return append(stream: Hot<U>(), initial: initial, withScanner: scanner)
  }
  
  public func first() -> Hot<T> {
    return appendFirst(stream: Hot<T>())
  }
  
  public func first(_ count: Int, partial: Bool = false) -> Hot<[T]> {
    return appendFirst(stream: Hot<[T]>(), count: count, partial: partial)
  }
  
  public func last() -> Hot<T> {
    return appendLast(stream: Hot<T>())
  }
  
  public func last(_ count: Int, partial: Bool = false) -> Hot<[T]> {
    return appendLast(stream: Hot<[T]>(), count: count, partial: partial)
  }
  
  public func reduce<U>(initial: U, reducer: @escaping (_ current: U, _ next: T) -> U) -> Hot<U> {
    return scan(initial: initial, scanner: reducer).last()
  }
  
  public func buffer(size: Int, partial: Bool = false) -> Hot<[T]> {
    return appendBuffer(stream: Hot<[T]>(), bufferSize: size, partial: partial)
  }
  
  public func window(size: Int, partial: Bool = false) -> Hot<[T]> {
    return appendWindow(stream: Hot<[T]>(), windowSize: size, partial: partial)
  }
  
  public func window(size: TimeInterval, limit: Int? = nil) -> Hot<[T]> {
    return appendWindow(stream: Hot<[T]>(), windowSize: size, limit: limit)
  }
  
  public func filter(include: @escaping (T) -> Bool) -> Hot<T> {
    return appendFilter(stream: Hot<T>(), include: include)
  }
  
  public func stride(_ stride: Int) -> Hot<T> {
    return appendStride(stream: Hot<T>(), stride: stride)
  }
  
  public func timeStamp() -> Hot<(Date, T)> {
    return appendTimeStamp(stream: Hot<(Date, T)>())
  }
  
  public func distinct(_ isDistinct: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendDistinct(stream: Hot<T>(), isDistinct: isDistinct)
  }
 
  public func min(lessThan: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendMin(stream: Hot<T>(), lessThan: lessThan)
  }
  
  public func max(greaterThan: @escaping (T, T) -> Bool) -> Hot<T> {
    return appendMax(stream: Hot<T>(), greaterThan: greaterThan)
  }
  
  public func count() -> Hot<UInt> {
    return appendCount(stream: Hot<UInt>())
  }
  
  public func delay(_ delay: TimeInterval) -> Hot<T> {
    return appendDelay(stream: Hot<T>(), delay: delay)
  }
  
  public func using<U: AnyObject>(_ object: U) -> Hot<(U, T)> {
    return appendUsing(stream: Hot<(U, T)>(), object: object)
  }
  
  public func merge<U>(_ stream: Stream<U>) -> Hot<Either<U, T>> {
    return appendMerge(stream: stream, intoStream: Hot<Either<U, T>>())
  }
  
  public func merge(_ stream: Stream<T>) -> Hot<T> {
    return appendMerge(stream: stream, intoStream: Hot<T>())
  }
  
  public func start(with: [T]) -> Hot<T> {
    return appendStart(stream: Hot<T>(), startWith: with)
  }
  
  public func concat(_ concat: [T]) -> Hot<T> {
    return appendConcat(stream: Hot<T>(), concat: concat)
  }
{'fraction_non_alphanumeric': 0.17985611510791366, 'fraction_numerical': 0.002092871157619359, 'mean_word_length': 3.5082547169811322, 'pattern_counts': {'":': 0, '<': 145, '<?xml version=': 0, '>': 225, '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': '894771', 'n_tokens_mistral': 2807, 'n_tokens_neox': 2703, 'n_words': 740}