I read somewhere that for 90% of a wide class of computing problems, you only need 10% of the source code in Haskell, that you would in an imperative language.

I found the post at the following link to be the most useful in explaining declarative versus imperative: http://www.haskell.org/pipermail/haskell-cafe/2009-September/067000.html Here follows what I want to add to the discussion: http://www.haskell.org/pipermail/haskell-cafe/2009-September/067094.html John Dorsey wrote:
Well, try this: Go ask a random person how you add up a list of numbers. Most of them will say something about adding the first two together, adding the third to that total, and so forth. In other words, the step by step instructions.
You word the (hypothetical) question with a bias toward imperative thinking. You're asking "How do you do this action?"
Why isn't the question "What is the sum of a list of numbers?", which is biased toward the declarative?
Instead ask "How do you add some numbers?" Then you will more likely get the answer, "add them together". The disconnect is that most people do not think in terms of details, so if you ask them to think in terms of how to declare "the order of the operation over the set in minimized semantics", you will push them into an area which they are not specialized. I have read the claim that Haskell tends to attract some of the most talented programmers, because it resonates with the mindset of people who like to generalize details into minimum rulesets. The most accurate question should be, "How do you add some numbers with minimized instructions?", because it forces them to realize they must order the set. An answer might be, "Zero if empty, else order the set, sum the first number with the sum of remainder of the set. Repeat for the sum of remainder." The real leap for me (not using my college math recently), and I am sure for most imperative programmers and people in general, is go from the recursive declaration above, to the notion that the declaration __IS__ the sum and does not just _return_ or output the sum. That notion becomes important when the declaration is not a single number result, instead a set. That is important because there is no way to _return_ an infinite set. The mind gets stuck on the recursive declaration of infinite sets, such as fibonacci, unless one comes from a mathematical mindset. Math is a muscle, it atrophies if you do not exercise it. And similarly to competitive muscles and aerobic capacity (speaking from my own experience), it only takes a little bit of exercise to get back to about 60% of former peak ability after a long period of no exercise.

Shelby Moore wrote:
The most accurate question should be, "How do you add some numbers with minimized instructions?", because it forces them to realize they must order the set.
An answer might be, "Zero if empty, else order the set, sum the first number with the sum of remainder of the set. Repeat for the sum of remainder."
Realize that I did not write "sort" order. I am refering to "queue" order that allows the "first" distinction. Also by "remainder" means "remaining portion of" (you are dividing the queue-ordered set by it's "tail" and thus "head" is the remainder). I just returned from 130 pushups and 1.2 mile run, and it was more difficult since I've not gotten out my thinking-cap chair for past 2 weeks. I wonder if our mental and physical exertion competes for the limited velocity at which our body can convert fuel to glucose and dump the cell waste products through the liver? Many people are already consumed by other exertions, many which are passive and compulsive (e.g. TV, reading same topics over and over again which are presented with superficial differences), which may atrophy their minds in terms of the brain patterns needed for logical induction.
participants (1)
-
Shelby Moore