Snippets tagged function composition

  • Composing a list of functions

    Composition of functions in F# is easily achieved by using the >> operator. You can also chain an arbitary amount of functions (represented as a list or sequence) together by folding the list/seq with >>. [More formally: the set of endomorphisms 'a -> 'a forms a monoid with the binary, associative operator ">>" (or "<<") and the neutral element "id".]

    77 people like this

    Posted: 6 years ago by Novox

  • Calculate Flesch Reading Ease Score (FRES)

    Calculate the Flesch Reading Ease Score for a string or a file. https://en.wikipedia.org/wiki/Flesch%E2%80%93Kincaid_readability_tests

    1 people like this

    Posted: 1 years ago by Kit Eason

  • FizzBuzz with Forward Composition

    This version of FizzBuzz uses forward composition instead of recursive pattern matching (see http://fssnip.net/e7). All the rules, including the default case, are in a list of lambdas that can be easily modified. The function executeRules composes the list into a single rule and executes it.

    0 people like this

    Posted: 4 years ago by Richard Broida