<commit_before>/** @license MIT License (c) copyright 2010-2016 original author or authors */

// id :: a -> a
export const id = x => x;

// compose :: (b -> c) -> (a -> b) -> (a -> c)
export const compose = (f, g) => x => f(g(x));

// apply :: (a -> b) -> a -> b
export const apply = (f, x) => f(x);<commit_msg>feat(function): add curry2 and curry3 implementations<commit_after>/** @license MIT License (c) copyright 2010-2016 original author or authors */

// id :: a -> a
export const id = x => x;

// compose :: (b -> c) -> (a -> b) -> (a -> c)
export const compose = (f, g) => x => f(g(x));

// apply :: (a -> b) -> a -> b
export const apply = (f, x) => f(x);

// curry2 :: (a -> b -> c) -> a -> b -> c
export function curry2(f) {
    function curried(a, b) {
        switch (arguments.length) {
            case 0: return curried;
            case 1: return b => f(a, b);
            default:return f(a, b);
        }
    }
    return curried;
}

// curry3 :: (a -> b -> c -> d) -> a -> b -> c -> d
export function curry3(f) {
    function curried(a, b, c) {
        switch (arguments.length) {
            case 0: return curried;
            case 1: return curry2((b, c) => f(a, b, c));
            case 2: return c => f(a, b, c);
            default:return f(a, b, c);
        }
    }
    return curried;
}
{'fraction_non_alphanumeric': 0.20167427701674276, 'fraction_numerical': 0.0213089802130898, 'mean_word_length': 1.9617117117117118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 44, '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': '6322835', 'n_tokens_mistral': 490, 'n_tokens_neox': 458, 'n_words': 165}