<commit_before>//  Copyright (c) 2014 <NAME>. All rights reserved.

/// A set of unique elements.
public struct Set<Element: Hashable>: CollectionType, ExtensibleCollectionType, SequenceType {
	// MARK: Constructors

	/// Constructs a `Set` with the elements of `sequence`.
	public init<S: SequenceType where S.Generator.Element == Element>(_ sequence: S) {
		self.values = [:]
		extend(sequence)
	}

	/// Constructs the empty `Set`.
	public init() {
		self.values = [:]
	}

	/// Constructs a `Set` with a hint as to the capacity it should allocate.
	public init(minimumCapacity: Int) {
		self.values = [Element:Unit](minimumCapacity: minimumCapacity)
	}


	// MARK: Properties

	/// The number of entries in the set.
	public var count: Int { return values.count }

	/// True iff `count == 0`
	public var isEmpty: Bool {
		return self.values.isEmpty
	}


	// MARK: Primitive methods

	/// True iff `element` is in the receiver, as defined by its hash and equality.
	public func contains(element: Element) -> Bool {
		return values[element] != nil
	}

	/// Inserts `element` into the receiver, if it doesn’t already exist.
	public mutating func insert(element: Element) {
		values[element] = Unit()
	}

	/// Removes `element` from the receiver, if it’s a member.
	public mutating func remove(element: Element) {
		values.removeValueForKey(element)
	}


	// MARK: Algebraic operations

	/// Returns the union of the receiver and `set`.
	public func union(set: Set) -> Set {
		return self + set
	}

	/// Returns the intersection of the receiver and `set`.
	public func intersection(set: Set) -> Set {
		return self.count <= set.count ?
			Set(filter(self) { set.contains($0) })
		:	Set(filter(set) { self.contains($0) })
	}<commit_msg>Move the Set() constructor to the outside.<commit_after>//  Copyright (c) 2014 <NAME>. All rights reserved.

/// A set of unique elements.
public struct Set<Element: Hashable>: CollectionType, ExtensibleCollectionType, SequenceType {
	// MARK: Constructors

	/// Constructs a `Set` with the elements of `sequence`.
	public init<S: SequenceType where S.Generator.Element == Element>(_ sequence: S) {
		self.values = [:]
		extend(sequence)
	}

	/// Constructs the empty `Set`.
	public init() {
		self.values = [:]
	}

	/// Constructs a `Set` with a hint as to the capacity it should allocate.
	public init(minimumCapacity: Int) {
		self.values = [Element:Unit](minimumCapacity: minimumCapacity)
	}


	// MARK: Properties

	/// The number of entries in the set.
	public var count: Int { return values.count }

	/// True iff `count == 0`
	public var isEmpty: Bool {
		return self.values.isEmpty
	}


	// MARK: Primitive methods

	/// True iff `element` is in the receiver, as defined by its hash and equality.
	public func contains(element: Element) -> Bool {
		return values[element] != nil
	}

	/// Inserts `element` into the receiver, if it doesn’t already exist.
	public mutating func insert(element: Element) {
		values[element] = Unit()
	}

	/// Removes `element` from the receiver, if it’s a member.
	public mutating func remove(element: Element) {
		values.removeValueForKey(element)
	}


	// MARK: Algebraic operations

	/// Returns the union of the receiver and `set`.
	public func union(set: Set) -> Set {
		return self + set
	}

	/// Returns the intersection of the receiver and `set`.
	public func intersection(set: Set) -> Set {
		return Set(self.count <= set.count ?
			filter(self) { set.contains($0) }
		:	filter(set) { self.contains($0) })
	}
{'fraction_non_alphanumeric': 0.12643348623853212, 'fraction_numerical': 0.0040137614678899085, 'mean_word_length': 3.4389312977099236, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, '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': '5059820', 'n_tokens_mistral': 1138, 'n_tokens_neox': 1036, 'n_words': 380}