<commit_before># Partially - flexible partial function application for ruby

## Basic Usage

    irb> require 'partially'
    
    # arguments that have the placeholder :_ will be bound later, all others bound now
    irb> replace_dog = :gsub.partially :_, 'dog', :_

    irb> statements = ['I like dogs', 'dogs have fur', 'my dog is great']

    # bind the deferred arguments (each statement and 'cat' in this case)
    irb> statements.map &replace_dog['cat'] 
    ['I like cats', 'cats have fur', 'my cat is great']
    
    # rebind the deferred arguments to something different
    irb> statements.map &replace_dog['cow'] 
    ['I like cows', 'cows have fur', 'my cow is great']

## Features

  * Bind some arguments now, others later, regardless of order (very verbose to do with straight Proc#curry)

  * Works with var-args: :\* ('match the rest') allows for the production of var-args functions from partial application     

       irb> sum = -\>(\*n) { n.inject(&:+) }
       irb> sum[1, 2, 3]
       6
       irb> addAllToOne = sum.partially 1, :\*
       irb> addAllToOne[2,4]
       7

  * Function arity is inferred automatically (unlike Proc#curry)
<commit_msg>fix indenting on list-embedded code block markdown in readme<commit_after># Partially - flexible partial function application for ruby

## Basic Usage

    irb> require 'partially'
    
    # arguments that have the placeholder :_ will be bound later, all others bound now
    irb> replace_dog = :gsub.partially :_, 'dog', :_

    irb> statements = ['I like dogs', 'dogs have fur', 'my dog is great']

    # bind the deferred arguments (each statement and 'cat' in this case)
    irb> statements.map &replace_dog['cat'] 
    ['I like cats', 'cats have fur', 'my cat is great']
    
    # rebind the deferred arguments to something different
    irb> statements.map &replace_dog['cow'] 
    ['I like cows', 'cows have fur', 'my cow is great']

## Features

  * Bind some arguments now, others later, regardless of order (very verbose to do with straight Proc#curry)

  * Works with var-args: :\* ('match the rest') allows for the production of var-args functions from partial application     

        irb> sum = -\>(\*n) { n.inject(&:+) }
        irb> sum[1, 2, 3]
        6
        irb> addAllToOne = sum.partially 1, :\*
        irb> addAllToOne[2,4]
        7

  * Function arity is inferred automatically (unlike Proc#curry)

{'fraction_non_alphanumeric': 0.10935550935550936, 'fraction_numerical': 0.006652806652806653, 'mean_word_length': 3.0505050505050506, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '388903', 'n_tokens_mistral': 761, 'n_tokens_neox': 711, 'n_words': 292}