Tools for haskell problem solving
Submitted by metaperl on Tue, 11/28/2006 - 6:43pm.
::
TYPING
This is your very first tool. Write out the type for the function that will solve your problem.
CASES
Write down your trivial base cases
INDUCTION STEP
You wrote down your accurate base case. Now imagine your function having to process an input data set with just one element more than your base case.
Then, write out that case algebraically
PICTURES OF DATA FLOW
Cale Gibbard has some nice pictures of how data can flow through functions when using foldl. And the technique is applicable elsewhere.
- metaperl's blog
- Login to post comments
Note these are all the top-down tools... one should not forget bottom up parsing as well.
Toss out the hard cases!
If you feel yourself knitting your brows while cooking up a solution to the problem, see what is giving you hissy fit, and ignore that case.