Talk:Dot product: Difference between revisions
m
no edit summary
No edit summary |
mNo edit summary |
||
(3 intermediate revisions by one other user not shown) | |||
Line 65:
:And, thanks! --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 19:36, 27 February 2016 (UTC)
:: Thanks – that seems sensible – On zip and
::<lang Haskell>zipWith :: (a->b->c) -> [a]->[b]->[c]
zipWith _f [] _bs = []
Line 73:
::: Hmm.... from my point of view, "robust" in the context of "programmer interaction" means: "easily describable" and "useful". But you also want to bubble problems up to the programmer. And, in my experience, "mis-matched lengths" is almost always a problem. If the programmer really wanted the shortest of the two, it's easy enough to discard the unwanted elements from the longer list.
::: Not sure about the larger issue, though -- I can see both sides of this and haven't made up my mind. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 21:25, 27 February 2016 (UTC)
::::Not sure how that looks – I've adjusted zipWith to return undefined when array lengths vary (it certainly does simplify the top level of dotProduct), and for the moment I've left the earlier code in place, and just reframed its characterisation. [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 22:08, 27 February 2016 (UTC)
::::(and, just now, swapping in your zipWith - which is much cleaner and more pleasing)[[User:Hout|Hout]] ([[User talk:Hout|talk]]) 00:41, 28 February 2016 (UTC)
:::::This looks good. Thanks. --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 01:47, 28 February 2016 (UTC)
|