Monday, May 11, 2009

Representing failure

I'm working on an algorithm that uses backtracking implemented with exceptions and handlers (rather than, say, explicit continuations). I just noticed that, for debugging, it's nice to represent the failure exceptions as records that contain not just the data about the operation that failed but also an optional list of other failure exceptions. In the disjunction cases, I can save the intermediate failures and, if they all fail, include them in the resulting failure record. This provides me with a nice data structure representing the control flow of the failed search tree. It only required modifying about 3 lines of code and the resulting data structure is easier to analyze than a manual debugging sequence. (I hate working with debuggers, even good ones.)

1 comment:

indoor Bars in Edmonton said...

Envious Design by Brandt and Thompson Has been in service Edmonton for many years and providing exceptional quality custom stone indoors and outdoors bars. We are expert in providing custom indoor Bars in Edmontonstone indoors; whether you need to upgrade your current, fireplace or you would like to add a new one we got you covers. With wide range of natural stones, we can give you a desired solution, which is built to last longer. Our custom stone indoor solution in Edmonton will not only provide you industrial