Talk:Dot product: Difference between revisions

Content added Content deleted
mNo edit summary
(zipWidth and 'functional')
Line 64: Line 64:


:And, thanks! --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 19:36, 27 February 2016 (UTC)
:And, thanks! --[[User:Rdm|Rdm]] ([[User talk:Rdm|talk]]) 19:36, 27 February 2016 (UTC)

:: Thanks – that seems sensible – On zip and zipWidth implementations, the ones that I am used to return a result with the length of the shorter input, which has the advantage I think, of allowing them to be both well-defined and a little more robust - reducing the range of values which will bottom out, and allowing for cases where the short match is specifically what's sought. The Haskell prelude zipWidth, for example is:
::<lang Haskell>zipWith :: (a->b->c) -> [a]->[b]->[c]
zipWith _f [] _bs = []
zipWith _f _as [] = []
zipWith f (a:as) (b:bs) = f a b : zipWith f as bs</lang>
:: On the incumbent function, my reservation is not so much about the properties of the code per se as the characterisation of it as 'functional', when it would actually break functional composition. Perhaps just leave it as a variant, without the jokey dedication ? [[User:Hout|Hout]] ([[User talk:Hout|talk]]) 21:18, 27 February 2016 (UTC)