Bulat Ziganshin wrote:
FP way is to represent everything as function, imperative way is to represent everything as algorithm.
Magnus Therning wrote:
Neither way may be "natural", but imperative thinking is extremely common in society, I'd say much more than "functional" thinking. Just think of cooking recipes, IKEA instructions, all the algorithms taught in math classes in grade school.
Those are not imperative thinking - they are sequential thinking. There is nothing non-functional about describing an algorithm in sequential form. Imperative means requiring that the steps always be followed exactly. People do not follow the steps of a recipe exactly - they just use the recipe to understand what needs to be prepared. Same with your other examples. That's why I think that the oposite is true - declarative style is more natural. Just describe what you want to be computed. If that is best described as a sequence of steps, fine, if not, not. But in either case, you are not forcing a CPU to follow the steps blindly. -Yitz _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe