Snippets tagged lambdas

  • 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

  • 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