Talk:Forward difference: Difference between revisions

delete remark 'verb fd'
(delete remark 'verb fd')
 
(3 intermediate revisions by 3 users not shown)
Line 10:
:::If your function was guaranteed to be called in such a way that you would never be called on to produce a forward difference of less than two values then no further checks need be done, but I think its wrong to argue that the forward difference of one value is an empty list just because a particular implementation would generate that - unless you extend ''your'' meaning of forward difference explicitly to handle this. --[[User:Paddy3118|Paddy3118]] 21:53, 27 August 2008 (UTC)
::::Except for those Rosetta Code tasks that specifically involve error-trapping, code solutions should assure that correct results are produced when the program is provided "good" input. Your claim is that input other than a numeric list of at least length two does not count as good. When the input is not good it is irrelevant what the code produces. Error reporting such as you have suggested has nothing to do with the task at hand. --[[User:TBH|TBH]] 18:21, 28 August 2008 (UTC)
:::::Which makes this whole section irrelevant! :-) --[[User:Paddy3118|Paddy3118]] 20:02, 28 August 2008 (UTC)
:I believe that it is completely mathematically consistent for the forward difference of a list of one element to be the empty list. For one thing, you can see that the forward difference of a list is usually a list one shorter; so the forward difference of a list of length 1 should be a list of length 0; i.e. the empty list. Also, a reasonable definition of forward difference is (the list without the first element) - (the list without the last element), where the "-" is an element-by-element subtraction of the sublists. In the case of the list of one element, both of those sublists are empty, and the result is the empty list. Now, I agree that the forward difference of an empty list should be an error, because it fails both of my above arguments (what is a list of length -1?). --[[User:Spoon!|Spoon!]] 19:09, 28 August 2008 (UTC)
::One shorter? Check! But your reasonable definition is an ''alternative'' definition whose output differs in this case under discussion. It would be better just to state what a forward difference of a list with one member should be - and so exclude one of the definitions, or, state that good input excludes this case. (Or delete the whole section from the talk page and pretend that all is well :-) --[[User:Paddy3118|Paddy3118]] 20:02, 28 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)
Line 16 ⟶ 18:
== J: verb vs adverb ==
 
With regard to the replacement of '''<tt>((}. - }:) ^:)</tt>''' by '''<tt>(2&(-/\))</tt>''':
I agree that a solution in the form of a verb is somewhat better than a solution that is an adverb, although the benefits strike me as subtle and minor.
I think the original solution is worth retaining as an example because of its form. It is not only a different algorithm, it is another strong example of how tacit form allows one to "code the concept." These two solutions complement one another, so both should be included.
Anonymous user