<commit_before>// swiftlint:disable conditional_binding_cascade

public class Node<T> {
    public let value: T
    public let left: Node?
    public let right: Node?
    public var parent: Node? = nil

    public init(value: T, left: Node? = nil, right: Node? = nil) {
        self.value =  value
        self.left = left
        self.right = right

        left?.parent = self
        right?.parent = self
    }

    public func inorder() -> [T] {
        var values = [T]()
        var current: Node? = self
        var previous: Node? = nil

        while let c = current {
            if let p = previous, let l = c.left where p === l {
                // Coming back up from the left child.
                values.append(c.value)
                current = c.right ?? c.parent
            } else if let p = previous, let r = c.right where p === r {
                // Coming back up from the right child.
                current = c.parent
            } else {
                // Coming down from the parent.
                if let l = c.left {
                    current = l
                } else {
                    values.append(c.value)
                    current = c.right ?? c.parent<commit_msg>[EPI/10.9/swift] Convert to new Swift version<commit_after>// swiftlint:disable conditional_binding_cascade

public class Node<T> {
    public let value: T
    public let left: Node?
    public let right: Node?
    public var parent: Node? = nil

    public init(value: T, left: Node? = nil, right: Node? = nil) {
        self.value =  value
        self.left = left
        self.right = right

        left?.parent = self
        right?.parent = self
    }

    public func inorder() -> [T] {
        var values = [T]()
        var current: Node? = self
        var previous: Node? = nil

        while let c = current {
            if let p = previous, let l = c.left, p === l {
                // Coming back up from the left child.
                values.append(c.value)
                current = c.right ?? c.parent
            } else if let p = previous, let r = c.right, p === r {
                // Coming back up from the right child.
                current = c.parent
            } else {
                // Coming down from the parent.
                if let l = c.left {
                    current = l
                } else {
                    values.append(c.value)
                    current = c.right ?? c.parent
{'fraction_non_alphanumeric': 0.09779050736497545, 'fraction_numerical': 0.0012274959083469722, 'mean_word_length': 1.3397129186602872, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '7116827', 'n_tokens_mistral': 688, 'n_tokens_neox': 645, 'n_words': 240}