<commit_before>fn main() {

    fn is_palindrome(n: i64) -> bool {
        let s = n.to_string();
        let rev: String = n.to_string().chars().rev().collect();
        s == rev
    }

    // println!("{}", is_palindrome(1234321));

    let mut largest = 0;

    for x in (800..999).rev() {
        for y in (800..999).rev() {
            let mult = x * y;
            if is_palindrome(mult) && mult > largest {
                println!("{}", mult);
                largest = mult
            }
        }
    }
}<commit_msg>Refactoring problem_4<commit_after>fn main() {

    fn is_palindrome(n: usize) -> bool {
        n.to_string() == n.to_string().chars().rev().collect::<String>()
    }

    let result = (800..999).rev()
        .map(|x| {
            (800..999)
                .rev()
                .map(|y| x * y)
                .filter(|&z| is_palindrome(z as usize))
                .max()
                .unwrap_or(0)
            })
        .max().unwrap();

    println!("{}", result);
}
{'fraction_non_alphanumeric': 0.18109452736318407, 'fraction_numerical': 0.03582089552238806, 'mean_word_length': 1.429951690821256, 'pattern_counts': {'":': 0, '<': 4, '<?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': '6775947', 'n_tokens_mistral': 361, 'n_tokens_neox': 328, 'n_words': 68}