<commit_before>//
//  ListProcessing.swift
//  Collections
//
//  Created by <NAME> on 12/23/16.
//
//

extension Array {
    
    // MARK: - List Processing
    
    /// First `Element` of a list.
    public var head: Element? {
        return self.first
    }
    
    /// Remaining `Elements` of a list.
    public var tail: Array<Element>? {
        
        guard !isEmpty else {
            return nil
        }
        
        return Array(self[1..<self.endIndex])
    }
    
    /**
     2-tuple containing the `head` `Element` and `tail` `[Element]` of `Self`
     
     -  note: From Chris Eidhof: http://chris.eidhof.nl/posts/swift-tricks.html
     */
    public var destructured: (Element, Array<Element>)? {
        guard let head = head, let tail = tail else { return nil }
        return (head, tail)
    }
}

extension ArraySlice {
    
    /// First `Element` of a list.
    public var head: Element? {
        return self.first
    }
    
    /// Remaining `Elements` of a list.
    public var tail: ArraySlice<Element>? {
        if self.isEmpty { return nil }
        return self[(self.startIndex + 1) ..< self.endIndex]
    }
    
    /**
     2-tuple containing the `head` and `tail`.
     
     -  note: From Chris Eidhof: http://chris.eidhof.nl/posts/swift-tricks.html
     */
    public var destructured: (Element, ArraySlice<Element>)? {
        guard let head = head, let tail = tail else { return nil }
        return (head, tail)
    }
}

/**
 - returns: New `Array` with the first element `head`, and the remaining elements of `tail`.
 */
public func + <T>(head: T, tail: [T]) -> [T] {
    return [head] + tail
}

/**
 - returns: New `Array` with `item` appended to the end of `list`.
 */
public func + <T>(list: [T], item: T) -> [T] {
    return list + [item]
}<commit_msg>Tidy up doc comments, add breathing room<commit_after>//
//  ListProcessing.swift
//  Collections
//
//  Created by <NAME> on 12/23/16.
//
//

extension Array {
    
    // MARK: - List Processing
    
    /// First `Element` of a list.
    public var head: Element? {
        return self.first
    }
    
    /// Remaining `Elements` of a list.
    public var tail: Array<Element>? {
        
        guard !isEmpty else {
            return nil
        }
        
        return Array(self[1..<self.endIndex])
    }
    
    /// 2-tuple containing the `head` `Element` and `tail` `[Element]` of `Self`
    /// - author: <NAME> (see: http://chris.eidhof.nl/posts/swift-tricks.html)
    public var destructured: (Element, Array<Element>)? {
        guard let head = head, let tail = tail else { return nil }
        return (head, tail)
    }
}

extension ArraySlice {
    
    /// First `Element` of a list.
    public var head: Element? {
        return self.first
    }
    
    /// Remaining `Elements` of a list.
    public var tail: ArraySlice<Element>? {
        if self.isEmpty { return nil }
        return self[(self.startIndex + 1) ..< self.endIndex]
    }
    
    /// 2-tuple containing the `head` `Element` and `tail` `ArraySlice<Element>` of `Self`
    /// - author: <NAME> (see: http://chris.eidhof.nl/posts/swift-tricks.html)
    public var destructured: (Element, ArraySlice<Element>)? {
        guard let head = head, let tail = tail else { return nil }
        return (head, tail)
    }
}

/// - returns: New `Array` with the first element `head`, and the remaining elements of `tail`.
public func + <T> (head: T, tail: [T]) -> [T] {
    return [head] + tail
}

/// - returns: New `Array` with `item` appended to the end of `list`.
public func + <T> (list: [T], item: T) -> [T] {
    return list + [item]
}
{'fraction_non_alphanumeric': 0.1443526170798898, 'fraction_numerical': 0.005509641873278237, 'mean_word_length': 2.0107794361525704, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, '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': '6415896', 'n_tokens_mistral': 1177, 'n_tokens_neox': 1154, 'n_words': 364}