Jump to content

Talk:Forward difference: Difference between revisions

No point in signalling error conditions.
mNo edit summary
(No point in signalling error conditions.)
Line 6:
:::Yes, that's the way to handle receiving an empty list. (A similar "corner case" has been discussed [[Talk:Maximum_subarray|here]].) <br>One of the things I appreciate about [[J]] is how many of these exception-situations have been resolved within the language itself. In this instance both the single-element and empty-list possibilities require no specific code. --[[User:TBH|TBH]] 09:45, 11 January 2008 (MST)
:The formula given '''Bn = An+1 - An''' only applies to lists of two or more elements. It could be argued that it is more correct to signal an error condition when given a list of less than two elements to work on.--[[User:Paddy3118|Paddy3118]] 04:42, 27 August 2008 (UTC)
::There are differences of opinion as to how best to handle input that does not lie within the domain of a function. My inclination is to (1) rely entirely on the error-reporting facilities of the programming environment, when possible, and (2) use a separate function to assure conformance of the input with the function, when necessary. In the case of forward difference we should also consider whether there is specific value to avoiding the definitional extensions that allow these functions to succeed when provided single-valued or empty lists. In the absence of a larger problem context I cannot see any benefit from producing error conditions instead of empty lists. --[[User:TBH|TBH]] 18:50, 27 August 2008 (UTC)
 
It is very nice to see the [[Python]] entry. Studying it has improved my grasp of that language. --[[User:TBH|TBH]] 09:45, 11 January 2008 (MST)
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.