<commit_before>//
//  Array+DHV.swift
//  WebResearch
//
//  Created by <NAME> on 6/5/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

extension Array {
    
    /**
     Move an element of an array to another index position.
     
     - parameters:
         - fromIndex: The index of an element in the array.
         - toIndex: The index of a position in the array to which to move the element
     */

    public mutating func moveElement(fromIndex fromIndex:Int, toIndex:Int) {
        self.insert(removeAtIndex(fromIndex), atIndex: toIndex)
    }
    
    /**
     Return a copy of an array with an element moved to another index position.
     
     - parameters:
         - fromIndex: The index of an element in the array.
         - toIndex: The index of a position in the array to which to move the element
     */

    public func arrayWithElementMoved(fromIndex fromIdex:Int, toIndex:Int) -> Array {
        var result = self
        result.moveElement(fromIndex: fromIdex, toIndex: toIndex)
        return result
    }
}<commit_msg>Adding method to remove a matching (Equatable) element from an array.<commit_after>//
//  Array+DHV.swift
//  WebResearch
//
//  Created by <NAME> on 6/5/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation

extension Array {
    
    /**
     Move an element of an array to another index position.
     
     - parameters:
         - fromIndex: The index of an element in the array.
         - toIndex: The index of a position in the array to which to move the element
     */

    public mutating func moveElement(fromIndex fromIndex:Int, toIndex:Int) {
        self.insert(removeAtIndex(fromIndex), atIndex: toIndex)
    }
    
    /**
     Return a copy of an array with an element moved to another index position.
     
     - parameters:
         - fromIndex: The index of an element in the array.
         - toIndex: The index of a position in the array to which to move the element
     */

    public func arrayWithElementMoved(fromIndex fromIdex:Int, toIndex:Int) -> Array {
        var result = self
        result.moveElement(fromIndex: fromIdex, toIndex: toIndex)
        return result
    }
}

extension Array where Element: Equatable {
    mutating func remove(object: Element) {
        if let index = indexOf({ $0 == object }) {
            removeAtIndex(index)
        }
    }
}
{'fraction_non_alphanumeric': 0.08235785953177258, 'fraction_numerical': 0.007107023411371237, 'mean_word_length': 2.269125683060109, 'pattern_counts': {'":': 0, '<': 7, '<?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': '1981389', 'n_tokens_mistral': 688, 'n_tokens_neox': 660, 'n_words': 260}