<commit_before>//
//  Ordering.swift
//  Ordering
//
//  Created by <NAME> on 10/29/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

public enum Ordering {
    case Ascending
    case Same
    case Descending
}

extension Ordering {
    public init<C: Comparable>(_ lhs: C, _ rhs: C) {
        if      lhs < rhs { self = .Ascending }
        else if lhs > rhs { self = .Descending }
        else              { self = .Same }
    }
    
    public init<C: Equatable>(_ lhs: C, _ rhs: C, isOrderedBefore: (C, C) -> Bool) {
        if lhs == rhs { self = .Same }
        else { self = isOrderedBefore(lhs, rhs) ? .Ascending : .Descending }
    }
}

extension Ordering {
    public var reversed: Ordering {
        switch self {
        case .Ascending:  return .Descending
        case .Descending: return .Ascending
        case .Same:       return .Same
        }
    }
}

infix operator <=> {
    associativity none
    precedence 130
}

public func <=><C: Comparable>(lhs: C, rhs: C) -> Ordering {
    return Ordering(lhs, rhs)
}<commit_msg>Added isEqual<commit_after>//
//  Ordering.swift
//  Ordering
//
//  Created by <NAME> on 10/29/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

public enum Ordering {
    case Ascending
    case Same
    case Descending
}

extension Ordering {
    public init<C: Comparable>(_ lhs: C, _ rhs: C) {
        if      lhs < rhs { self = .Ascending }
        else if lhs > rhs { self = .Descending }
        else              { self = .Same }
    }
    
    public init<C: Equatable>(_ lhs: C, _ rhs: C, isOrderedBefore: @noescape (C, C) -> Bool) {
        if lhs == rhs { self = .Same }
        else { self = isOrderedBefore(lhs, rhs) ? .Ascending : .Descending }
    }
    
    public init<C>(_ lhs: C, _ rhs: C, isEqual: @noescape (C, C) -> Bool, isOrderedBefore: @noescape (C, C) -> Bool) {
        if lhs == rhs { self = .Same }
        else { self = isOrderedBefore(lhs, rhs) ? .Ascending : .Descending }
    }
}

extension Ordering {
    public var reversed: Ordering {
        switch self {
        case .Ascending:  return .Descending
        case .Descending: return .Ascending
        case .Same:       return .Same
        }
    }
}

infix operator <=> {
    associativity none
    precedence 130
}

public func <=><C: Comparable>(lhs: C, rhs: C) -> Ordering {
    return Ordering(lhs, rhs)
}
{'fraction_non_alphanumeric': 0.12627118644067797, 'fraction_numerical': 0.011016949152542373, 'mean_word_length': 1.9961928934010151, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 26, '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': '4187112', 'n_tokens_mistral': 827, 'n_tokens_neox': 788, 'n_words': 241}