[Haskell-cafe] capture of idioms and patterns

Dan Piponi dpiponi at gmail.com
Thu Sep 23 19:13:01 EDT 2010


On Thu, Sep 23, 2010 at 1:57 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:

> If you think that sounds silly, ask some random person (not a computer
> programmer, just some random human) how find the sum of a list of numbers. I
> can practically guarantee that most humans will reply "do X, then do Y, and
> then do Z". Almost nobody will reply with "the sum of an empty list is
> defined as zero, and the sum of a non-empty list is defined as the addition
> of the first element and the sum of the remaining elements". To a normal
> human, that almost sounds like a riddle rather than an explanation.

I don't think it's unusual for a "random person" to give a recursive
answer. It's just that a "normal human" tends to avoid anything that
isn't tail recursion. For example, I can easily imagine someone saying
"to sum a list, add the current element to the running total, and now
carry on summing from the next element". I doubt most people would
consider that to be a riddle.

The problem is that humans don't have deep stacks, so they find it
harder to talk in terms of methods that require deep stacks.
--
Dan


More information about the Haskell-Cafe mailing list