[Haskell-cafe] capture of idioms and patterns

Albert Y. C. Lai trebla at vex.net
Fri Sep 24 17:02:44 EDT 2010


On 10-09-23 04:57 PM, Andrew Coppin 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.

My reply: to sum 10 numbers, sum 9 numbers, then account for the 10th. 
More at:
http://groups.google.com/group/comp.lang.functional/msg/51df24fbf33b7059

Ask some random person how to find page 314 in a book. No one replies 
"check the 1st page, check the 2nd page, check the 3rd page...". In 
fact, no one replies in words. Almost everyone shows you how to cut to 
the middle or the estimated weighted middle (if the book seems to have 
1000 pages, they cut near the one-third point), then say "oh, before 
this" or "oh, after this", repeat. Almost everyone divides and conquers. 
Almost everyone recurses.

I am not a computer programmer.

(I know that someone is bound to think, "when confronted with the 
problem of summing numbers, some people think, 'I know, I will divide 
and conquer'. Now they have two problems of summing numbers.")


More information about the Haskell-Cafe mailing list