<commit_before>import __ from "lodash";
import _ from "lodash-fp";

export const split = _.curry((delimiter, str) => str.split(delimiter));

export const join = _.curry((delimiter, str) => str.join(delimiter));

export const multiply = _.curry((x, y) => x * y, 2);

export const merge = (f, ...values) => __.merge(...values, f);

export const reverse = (x) => x.reverse();

export const warpValue = (x, max) => ((x % max) + max) % max;

export function log(x) {
    console.log(x);

    return x;
}

export const groupBy = _.curryRight(__.groupBy, 2);

// A less annoying _.fill function.
export const fill = _.curry((x, arr) => _.map(() => x, arr));

export const doWhile = _.curry((f, g, x) => {
    let y = f(x);<commit_msg>Added a helper for String.match. Refactored fill (from day 21).<commit_after>import __ from "lodash";
import _ from "lodash-fp";

export const split = _.curry((delimiter, str) => str.split(delimiter));

export const join = _.curry((delimiter, str) => str.join(delimiter));

export const match = _.curry((pattern, str) => str.match(pattern));

export const multiply = _.curry((x, y) => x * y, 2);

export const merge = (f, ...values) => __.merge(...values, f);

export const reverse = (x) => x.reverse();

export const warpValue = (x, max) => ((x % max) + max) % max;

export function log(x) {
    console.log(x);

    return x;
}

export const groupBy = _.curryRight(__.groupBy, 2);

// A less annoying _.fill function.
export const fill = (x, collection) => _.map(_.constant(x), collection);

export const doWhile = _.curry((f, g, x) => {
    let y = f(x);
{'fraction_non_alphanumeric': 0.1856060606060606, 'fraction_numerical': 0.003787878787878788, 'mean_word_length': 3.7740963855421685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, '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': '56076', 'n_tokens_mistral': 561, 'n_tokens_neox': 544, 'n_words': 173}