On Thu, 30 May 2013 10:12:22 -0700, rusi wrote: > On Thu, May 30, 2013 at 9:34 AM, Ma Xiaojun <damage3...@gmail.com> > wrote:
>> Wait a minute! Isn't the most nature way of doing/thinking "generating >> 9x9 multiplication table" two nested loop? > > Thats like saying that the most natur(al) way of using a car is to > attach a horse to it. >[...] > Likewise in the world of programming, 90% of programmers think > imperative/OO programming is natural while functional programming is > strange. Just wait 10 years and see if things are not drastically > different! It won't be. Functional programming goes back to Lisp, which is nearly as old as Fortran and older than Cobol. There have been many decades for functional languages to become mainstream, but they've never quite done it. There's no reason to think that the next decade will see a change to this. That's not to say that functional programming isn't one of the big three programming paradigms. But it's third out of the three, and quite a bit behind the other two: Procedural OOP Functional with Logic programming a distant fourth. Well, perhaps even third, ahead of Functional, taking into account that SQL is a form of Logic programming. Some modern Functional languages are really neat, like Haskell, but I think the sad truth is that to really master them (and not just make do with a small percentage of their functionality) is beyond 90% of programmers. I'm not ashamed to admit that I struggle with advanced FP concepts. But even if only a minority of programmers can master languages like Lisp, Haskell, or Scheme, doesn't mean that *all* programmers can't learn something from them. Functional programming is at least 50% a philosophy: * pass arguments to functions, and return results, rather than getting and setting state from a variable. This is a good strategy: it makes it easier to reason about the code, easier to document, easier to test, and makes it practical to use it in threaded code. -- Steven -- http://mail.python.org/mailman/listinfo/python-list