[Haskell-cafe] Is this haskelly enough? -- errm but every answer
westondan at imageworks.com
Tue Jul 17 21:08:22 EDT 2007
Correct, efficient, elegant: you can only have two out of three. I see
where your priorities lie! :)
Anthony Clayden wrote:
> (Or at least the problem is under-specified.)
> 1. There may be several sub-sequences having the maximum
> So the type for the solution should be :: Num a => [a] ->
> (Note that the problem didn't ask for the maximum
> 2. The inits . tails approach adds a fault:
> It introduces a sprinkling of empty sub-sequences. These
> have sum zero.
> So in case the input list is all negative numbers ...
> Being a software tester for my day job, I looked first not
> for an elegant and/or efficient solution; but for where to
> stretch the boundaries of the problem.
>> However, the key point is that this is a TRICK QUESTION.
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe