Re: Re: General--Difficulties in Understanding Mathematica Syntax
- To: mathgroup at smc.vnet.net
- Subject: [mg69068] Re: [mg69006] Re: General--Difficulties in Understanding Mathematica Syntax
- From: János <janos.lobb at yale.edu>
- Date: Tue, 29 Aug 2006 03:26:06 -0400 (EDT)
- References: <echdk4$oir$1@smc.vnet.net> <ecmgpr$9b3$1@smc.vnet.net> <200608260604.CAA02766@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On Aug 26, 2006, at 2:04 AM, AES wrote: > In article <ecmgpr$9b3$1 at smc.vnet.net>, > Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com> wrote: > >> >> Now, it is utterly better to use high-level constructs such as Map, >> Thread, Apply, ... when you code in Mathematica. >> > > I don't exactly quarrel with this -- but I sure don't fully accept it > either. > > Concepts like Map[ ], Thread[ ], Apply[ ] are thoroughly understood by > adepts, and marginally understood by some of the rest of us. They're > not concepts, or terms, commonly used in everyday speech. And they > may > have some hidden subtleties in their operation, even some > "gotchas", in > how they apply to what's inside the [ ]s. > > Constructs like Do[] , If[ ], While[ ] are fairly likely to be > understood not just by adepts, but by anyone who's ever done even very > elementary programming in (horrors!) BASIC. Their programming use > matches up pretty well with the same terms in everyday speech. They > make the flow of the program logic more obviously visible (at least to > us non-adepts). And I suspect they have fewer hidden gotchas. > > Writing complex Mathematica expressions as dense, deeply nested, > sometimes lengthy expressions full of arcane shorthands ("\\@", > etc) is > akin to writing dense, arcane, possible lengthy prose sentences > full of > arcane terminology. Writing them as short, crisp, clear > constructs, one > task at a time, is like writing short, crisp, clear prose sentences. > The people who construct "readability indexes" for prose have some > opinions about this. > > [We all, of course, fondly remember APL: "Code once, read or modify > never".] > > What is it that's actually **better** (for the "ordinaryt user") about > these more sophisticated constructs? > > * Readability? -- except for adepts, I don't think so. > > * Faster, more efficient execution? -- perhaps so, but in the vast > majority of cases, who cares?!? > > * More accurate execution? -- I sure hope not. > > * Shorter code (fewer characters)? -- again, who cares?!? > > * Bragging rights (I can accomplish the task with fewer characters > than > anyone around)? -- Well, that was a very salable skill, in magnetic > core > and assembly language days. > > Again, to each his own. Part of the genius of Mathematica is that it > serves the novice user and the sophisticated adept. But "better"? Newbie comment :) - It took me to get used to Map about as much time that it took me to get used to LET in Algol 60 :) - For me better usually means how efficient the programming structure is when I try to scale. For data elements of a few hundred almost every construct works, but when I scale up to a few hundred thousand or million data elements, then functional constructs proved to be much BETTER. János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)
- References:
- Re: General--Difficulties in Understanding Mathematica Syntax
- From: AES <siegman@stanford.edu>
- Re: General--Difficulties in Understanding Mathematica Syntax