Re: confusing Mathematica?

*To*: mathgroup at smc.vnet.net*Subject*: [mg30280] Re: confusing Mathematica?*From*: "Oliver Friedrich" <oli.fri at gmx.de>*Date*: Sat, 4 Aug 2001 20:02:08 -0400 (EDT)*References*: <9kg13o$igc$1@smc.vnet.net>*Sender*: owner-wri-mathgroup at wolfram.com

Hallo Michael, sure you don't confuse Mathematica with too many nested loops. I'm already sure, that you have a real syntax error. If I have a "cannot be followed by" syntax, it is often a colon in a list, where I deleted the last element and forgot to delete the last colon. When Mathematica 's moving around text, it tries to format your code into different nested hierarchies according to your code parts. Moving around the text is often caused by a mismatching pair of [] or() or {}. Maybe you put a } where Mathematica excepts ] and so on. When you're really mad with your code. Dump it and begin from the start. Most of my nested nested expressions (the famous Mathematica one-liners) are constructed iteratively from the inner to the outer function. I'm really a big one-liner fan and enjoy abbrevations like #[[1]]&@@/ but it makes the code a little bit bizarre to read! Here I try to represent hierarchy by indenting lower hierarchical lines. Looks like this: FunctionA[ FunctionB[ blabla,blabla,{a,b,c,d,e}], {FunctionAoption->blabla,...}] Try this approach, I hope it will help you Oliver Friedrich Michael schrieb in Nachricht <9kg13o$igc$1 at smc.vnet.net>... >I've got a rather length function consisting of a module within a block >within a block. Within the module is a while statement containing at a >particular point an if within a replace within an if. > >Upon routine editing I happened to make the following change: > >... >If[<condition>, > (* Here I inserted the rest of this line: *) Map[(X)&,vars]; > (* This comment was already here... *) > If[<valid stuff here>]; >, > > >and suddenly I get a huge syntax error looking something like this... > >Syntax::sntxf : >"If [<<1>>,<<1>>]; cannot be followed by "(code snipped)". > >The error is nowhere near where I actually insert the line. The problem is, >when I delete the line I just added I *still* get an error. The way the >front end spuriously moves text around while I am trying to complete >brackets and braces is most unhelpful, and I thought perhaps I had made a >change somewhere else in the function without realizing it. But after a >long time trying to figure out where the error is, I ran diff against the >original function and the function Mathematica doesn't like, and there is no >difference. > >Any ideas what is going on here? Am I confusing Mathematica with so many >things nested inside each other? > >Michael > > >