mark: haskell version with a memoizing function
mark: removing unnecessary code
mark: don't really need the cache type
mark: handle command line args
mark: a version which passes the cache around