Snippets created by Richard Broida

  • FizzBuzz with Rule Engine

    Inspired by http://dave.fayr.am/posts/2012-10-4-finding-fizzbuzz.html Rules are in a list of lambdas that can be easily modified. A pattern-matching recursive function applies them in the correct order.

    7 people like this

    Posted: 11 years ago by Richard Broida

  • Apply Operators to Options

    Simple function to apply operators to option types. Applies the operator to each value and returns a new option containing the result. Treats None as the operator's identity element (i.e., ignores it).

    1 people like this

    Posted: 11 years ago by Richard Broida

  • 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: 11 years ago by Richard Broida