Re: Thinking Mathematica: Any suggestions?
- To: mathgroup at smc.vnet.net
- Subject: [mg91735] Re: Thinking Mathematica: Any suggestions?
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 7 Sep 2008 05:32:52 -0400 (EDT)
On 9/6/08 at 2:06 AM, dave at Remove_Thisdbailey.co.uk (David Bailey) wrote: >I know I will get flamed for saying this, but unless you will need >high performance - not every Mathematica problem requires a lot of >CPU - you may be best to start programming in a procedural way, and >gradually start to learn functional programming later when you are >more comfortable with Mathematica syntax. I think there should be a caveat on you suggestion here. If there is a need to get create code that solves a particular problem quickly, then yes by all means use what you are most familiar with. But if there is no such schedule pressure, then it is better to forget For etc exist in Mathematica. The time spent learning Mathematica's functional paradigm now will pay dividends later. Also, I believe there are more benefits to learning Mathematica's functional paradigm than just high performance. For example, with For loops it is easy to make the error of using say n<100 when you should have used n<=100 resulting in no processing the last item. The functional approach eliminates the possibility of this type of error. That is, I believe less time will be spent debugging a program that uses a functional approach in Mathematica than a program that uses a procedural approach. I agree, it requires quite a bit of time/effort to become proficient with Mathematica's functional paradigm. But using procedural code as a crutch won't reduce the amount of time/effort needed. I strongly suspect the approach of slowly introducing functional code in place of procedural code not only delays learning of the functional paradigm but requires more time overall. That is I believe learning is more efficient if there are not significant gaps - periods where no learning is needed since things are being done in a way already learned.