<commit_before>//  Loosly speaking, Active patterns allow you to create
//  functions that are good at extracting structured
//  data.

//  Let make one.

//  I'm going to need my Banana clips (|  |)

open System

let (|Odd|Even|String|)(s:string) = 
    let (isInt, value) = Int32.TryParse(s)
    if isInt then
       if value % 2 = 1 then Odd(value)
       else Even(value)
    else String(s)

let tellMeAbout(s:string) = 
    match s with
    | Odd(value) -> sprintf "%i is odd!" value
    | Even(value) -> sprintf "%i is even!" value
    | String(value) -> sprintf "%s is a string!" value<commit_msg>Added Active Patterns snip<commit_after>//  Loosly speaking, Active patterns allow you to create
//  functions that are good at extracting structured
//  data.

//  Let make one.

//  I'm going to need my Banana clips (|  |)

open System

let (|Odd|Even|String|)(s:string) = 
    let (isInt, value) = Int32.TryParse(s)
    if isInt then
       if value % 2 = 1 then Odd(value)
       else Even(value)
    else String(s)

let tellMeAbout(s:string) = 
    match s with
    | Odd(value) -> sprintf "%i is odd!" value
    | Even(value) -> sprintf "%i is even!" value
    | String(value) -> sprintf "%s is a string!" value

//  Per this example, active patterns are used in 
//  conjunction wit the match with syntax (Pattern matching)

//  Well talk more.  See you soon...
{'fraction_non_alphanumeric': 0.1217201166180758, 'fraction_numerical': 0.0058309037900874635, 'mean_word_length': 2.771978021978022, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '7556917', 'n_tokens_mistral': 464, 'n_tokens_neox': 448, 'n_words': 168}