<commit_before>//
//  Mutation.swift
//  Fountain
//
//  Created by <NAME> on 12/15/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

/// Based on https://twitter.com/jckarter/status/675445367542968320
func applied<T, U> (transform: inout T -> U -> ()) -> T -> U -> T {
    return { a in
        { b in
            var mutable = a
            transform(&mutable)(b)
            return mutable
        }
    }
}<commit_msg>Adding operator for applied<commit_after>//
//  Mutation.swift
//  Fountain
//
//  Created by <NAME> on 12/15/15.
//  Copyright © 2015 <NAME>. All rights reserved.
//

/// Based on https://twitter.com/jckarter/status/675445367542968320
func applied<T, U> (transform: inout T -> U -> ()) -> T -> U -> T {
    return { a in
        { b in
            var mutable = a
            transform(&mutable)(b)
            return mutable
        }
    }
}

infix operator <-> {
    associativity right
    precedence 170
}

func <-><T, U>(f: inout T -> U -> (), t: T) -> U -> T {
    return t |> (applied <| f)
}
{'fraction_non_alphanumeric': 0.16488845780795344, 'fraction_numerical': 0.05722599418040737, 'mean_word_length': 1.7891891891891891, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 27, 'https://': 2, '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': '775678', 'n_tokens_mistral': 398, 'n_tokens_neox': 352, 'n_words': 101}