MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Whitespace weirdness.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74390] Re: Whitespace weirdness.
  • From: dh <dh at metrohm.ch>
  • Date: Mon, 19 Mar 2007 22:04:10 -0500 (EST)
  • References: <etlcva$o16$1@smc.vnet.net>


Hi,

if I copy your code to my notebook, I get twice exactly the same 

expressions. However, I get an error message because of the following 

construct:

Function[...]

[argument]

try this in a notebook and you will see that this superficially correct 

syntax will create an error. The reason is, that the frontend will 

execute a line if it contains a valid expression. Function[...] is a 

valid expression and returns itself. However, the next line [argument] 

is not a valid expression and is rejected.

However, what I can not explain is, that the continuation character 

(backlash) is not working in this case. Has anybody a good idea? Is it a 

bug?

Daniel





wooks wrote:

> Clear[Eternity,x];

> Eternity[x_]:=Eternity[x];

> 

> Clear[EmptyQ];

> EmptyQ[{}] := True;

> EmptyQ[x_List] := False;

> EmptyQ[x_] := Print["Argument to EmptyQ must be a list."];

> 

> Clear[length,list,f,g]

> Function[f,

>     Function[list,If[EmptyQ[list],0,

>                                             1+f[Rest[list]]]]]

> [Function[g,

>  

> Function[list,If[EmptyQ[list], 0,

>                                                                 1 +

> g[Rest[list]]]]][Eternity]]

> 

> Clear[length,list,f,g]

> Function[f,

>   Function[list,If[EmptyQ[list],0,

>                                           1+f[Rest[list]]]]]

> [Function[g,Function[list,If[EmptyQ[list], 0,

>                                                                 1 +

> g[Rest[list]]]]][Eternity]]

> 

>  Here are 2 versions of the same anonymous function. The only

> difference between them is that in the second version Function[g....

> starts on a new line.

> 

> One of them works. The other generates a syntax error.

> 

> 




  • Prev by Date: Re: NDSolve doesn't stop
  • Next by Date: Re: Initialization cell appearance
  • Previous by thread: Re: Whitespace weirdness.
  • Next by thread: Re: Whitespace weirdness.