CS 214: Programming Languages
Spring 2009

Home|Syllabus|Schedule
<<|>>|Haskell templates

More Factorials
Haskell, Iteration 4

Wikipedia lists a bunch of "Factorial-like products" ("products" in the mathematical sense, not the "factorial on a t-shirt" sense")

Your Turn

Pick two of these, an implement both of them two ways (patterns, guards, ifs). So you'll have four new functions implementing two new factorial-like products. Write tests that green bar. Do your work in the existing files in languages/haskell/factorial.

For your tests, you should have two assertions more than the number of base cases. (For example, the double factorial has two base cases, so you should have at least four assertions for it.) At least one of the assertions should be non-trivial. (Fortunately, wikipedia has the sequences right there.)