Comment on An Introduction to Condition Handling for Non-LispersComments−howeyc14yFor anyone that had trouble learning the condition system, or just wants another example, this helped me:http://symbo1ics.com/blog/?p=1405−qznc14yThat task here is: A 'compute-slopes' function gets a list of points and returns a list of slops between consecutive points.The problem: What if points have the same x-value, hence the slope is undefined.Solution 1 Exceptions: throw new DivisionByZero()Solution 2 Condition Handling: provide the restarts point to (a) return nil, (b) return 0, and (c) return a user-specified value.Solution 3 Return Error: return Error("division by zero")
Comments
For anyone that had trouble learning the condition system, or just wants another example, this helped me:
http://symbo1ics.com/blog/?p=1405
That task here is: A 'compute-slopes' function gets a list of points and returns a list of slops between consecutive points.
The problem: What if points have the same x-value, hence the slope is undefined.
Solution 1 Exceptions: throw new DivisionByZero()
Solution 2 Condition Handling: provide the restarts point to (a) return nil, (b) return 0, and (c) return a user-specified value.
Solution 3 Return Error: return Error("division by zero")