That’s a pretty interesting way to describe dynamic programming. I would probably have wrapped this up somehow so that the caller isn’t having to carry around a reference to the cache (instead having a (function, cache) pair that knows how to operate on things properly), but the image of the function operating directly on the user’s array is fun.
That’s a pretty interesting way to describe dynamic programming. I would probably have wrapped this up somehow so that the caller isn’t having to carry around a reference to the cache (instead having a (function, cache) pair that knows how to operate on things properly), but the image of the function operating directly on the user’s array is fun.
douglas-mcllroy’s paper ‘squinting at power series’ is pretty good, and uses haskell for elucidating these concepts. check it out !
if you like that kind of thing, it is the kind of thing that you would like :)